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

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

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