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

  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..

  Catch clauses are listed is important

write a program that can be used to demonstrate that the order in which catch clauses are listed is important

  The program calls a function called getgrades

The program calls a function called GetGrades that will read in grades from the keyboard, the number of grades should also be input by the user.

  Write a switch-case programming for calculation

How to use C++ to write a switch-case programming for calculation? Test the program for a wide range of possible inputs including division by zero and square root of negative values.

  Objective1 to give students practice in calling and writing

objective1. to give students practice in calling and writing their own functions.2. to give students practice in

  Write main function to compute stress-strain in steel rod

Write a main function and the following functions to compute the stress and strain in a steel rod of diameter D (inches) and length L (inches) subject to the compression loads.

  C program to calculate power loss in transmission line

Write program in C to calculate the power loss in transmission line with resistance of 0.05 ohms/mile. Calculate power loss if 500 kW of power is transmitted from power generation station

  Evaluate the mathematical constant of p

Write a C++ program to evaluate the mathematical constant of PI - Guess a random number between 0.00 and 1.00 and assign this to x.

  Write program to calculate net pay for factory worker

Write and run a program in C++ that calculates the net pay for a factory worker. The program prompts the user for skill level and hours worked, as well as appropriate insurance and retirement options for the employee's skill.

  Economy of kenya has a budget deficit

The economy of Kenya has a budget deficit of KSH 500B. This deficit is likely to be funded through domestic borrowing and taxation. Using an appropriate model, explain the macroeconomic implications of such a move.

  Declare element array of chars named letters

Declare a 12-element array of chars named letters and what does the following program segment display?

  Implement the vector class using inheritance

Is it better to implement the Vector class using inheritance (is-a relationship) or composition (has-a relationship). In other word, which one of the following gives a better implementation?

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