Write a c program that reads in two sets of numbers a and b

Assignment Help C/C++ Programming
Reference no: EM13969423

Sets of numbers can be represented using array of 0s and 1s. The idea is that a[i]!=0 if iis in the set, and a[i] == 0 if it is not. For example, the array a[10] = {0, 0, 1, 0, 1, 1, 0, 0, 0, 0}wouldrepresenttheset{2, 4, 5} becausea[2],a[4],anda[5] have the value 1, and everywhere else a contains zeros. Since the array has a fixed bound, say N, the values in the set are restricted to the range 0...N-1.

Write a C program that reads in two sets of numbers A and B, and calculates and print their union (AυB) and intersection (A∩B). (AυB) is the set of elements that appear in either A or B, and thatA∩B is the set of elements that appear in both A and B. The values in the sets are restricted to the range 0... 9.

1) Name your program sets.c.

2) The program will read in the number of element in the first set, for example, 4, then ?read in the numbers in the set, for example, 3 6 8 9. The repeat for the second set. The ?two sets do not necessarily are of the same size.

3) The sets are stored using arrays of 0s and 1s as described above.

4) Calculate the union and intersection of the two sets and display the result.

5) Sample input/output:

Reference no: EM13969423

Questions Cloud

Examine the goodness of fit of the model : Examine the goodness of fit of the model - Derive the probability mass function of the beta-binomial distribution and write it in the form
Explain three benefits of conducting an external analysis : Explain three benefits of conducting an external analysis. Educate Mr. Perry on some of the challenges of conducting an external analysis. Explain the two perspectives on the environment.
Secondary data in gaining customer insights : Explain the role of secondary data in gaining customer insights. Where domarketers obtain secondary data and what are the potential problems in usingit?
Define the following terminology-latent heat of vaporization : Define the following Terminology: Latent Heat of Vaporization, Vapor Pressure, Saturated Vapor Pressure, Relative Humidity, Potential Evaporation Rate, Pan Evaporation Rate, Transpiration
Write a c program that reads in two sets of numbers a and b : Write a C program that reads in two sets of numbers A and B, and calculates and print their union (AυB) and intersection (A∩B). (AυB) is the set of elements that appear in either A or B, and thatA∩B is the set of elements that appear in both A and B...
What was jaynes monthly mortgage payment : Jayne purchased a home for $240,000.00 with a down payment of $48,000.00. The rate of interest was 5-3/4 for 30 years. What was her monthly mortgage payment?
Evaluate the impact to the accounting profession should priv : Evaluate the impact to the accounting profession should privately held companies be required to use U.S.GAAP while publicly traded companies are required to IFRS.
Determining the random numbers for sales : Janes's Auto World has a policy of placing an order for 27 of the most popular model whenever inventory reaches 20. Lead time on delivery is two weeks, and 25 automobiles are currently on hand. Simulate 15 weeks's worth of sales using the followin..
Assume that the privately held technology company : Assume that the privately held technology company decides to become a publicly traded company on the NASDAQ and is required to adopt International Financial Reporting Standards (IFRS).

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write c program for linked list applications

Write a complete C program which illustrates the Linked list applications data structures and algorithms. The program will read in mid-semester test scores as Main Linked List and produce six outputs:

  Write a c program for a hcs12 micro controller that writes

Write a C program for a HCS12 microcontroller that writes the value, 0x78, to Memory Location VAR1 and then calls a delay function. The delay function should generate a delay of 0.25 milliseconds

  Create codes for the following problem compile and test run

Create codes for the following problem/s. Compile, test run, and edit them if necessary. Include your original .cpp and related file(s) (if any) in a single folder. Name the folder CIS110_Module_4. Compress (zip) the folder and submit the sing..

  Consider the following idealized wimax scenario.

In mobile IP, what effect will mobility have on end-to-end delays of data-grams between the source and destination?

  What is realistic rendering in computer graphic

Differentiate between pillar boxing and the letter boxing. What is realistic rendering in computer graphic. Discuss the approach used in realistic rendering.

  What are the contents of the array

What are the contents of the array after the subsequent loops complete - loops and also provide the iteration how to get it.

  Effect on the monthly contribution margin

Although the Missouri Company has the capacity to produce 16,000 units per month, current plans call for monthly production and sales of only 10,000 units at $15 each. Costs per unit are as follows:

  Generate the initial deck of cards.

It may also enable the top card in the waste pile to be placed The adjustments are made until nothing can be moved. Play continues until all of the original cards in the deck are in play and all adjustments are made

  C programs hat print out the max, min, and the average value

Write three C programs that print out the max, min, and the average values of the data file included below. Be sure to include the outputs of the programs in your solutions. Use three data file structures (counter, sentinel, and neither counter/senti..

  Describe an example of a base

Describe an example of a base and a derived class that shows base-class functions that are overridden in the derived class. Provide the syntax, showing the class definitions of both classes.

  Viewer features of the application

Sharon has started to use both the stock details management and the file information viewer features of the application. However, while using the file information viewer application, she accidentally enters the path of a folder that does not exist..

  Generic binary tree using java generics

In this project you will create a generic binary tree using Java Generics.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd