The program has six subtasks. Following operations are performed on sets as follows. Union of two sets. Intersection of two sets. Subtraction of two sets. The program has 7 functions implementing all the above operations DATA TYPE USED:-
The data type used is integer array. Integer array datatype is used to store the elements in a set. FUNCTIONS :- 1) Input :- The first function is used to accept the elements in the set. Here , in this program I accept the set of students playing cricket (say C[ ] ) and of students playing badminton ( B[ ] ) according to our problem statement. 2) Output:- This function is used to display the sets of students playing cricket and badminton. 3) Intersection:- This function shows the common elements of both the sets.Here in our program, intersection function shows the students playing both cricket and badminton. It is represented by (B∩C). 4) Union:- This function shows the result of combination of two sets. This function will display the students playing atleast one game i.e cricket or badminton (or both). It is represented by (BUC). 5) Subtraction:- Consider the operation (C-B), so in this operation, elements which are only in set C and not in set B are displayed. In our program,I used cricket and badminton sets(Functions), so in function cricket, students playing only cricket will be displayed and in function badminton , students playing only badminton will be displayed. 6) Complement:- Complement of a set is nothing but elements of universal set which are not present in the set. In this program by using this concept, I are going to display no. of students not playing any game .. This program is menu-driven and will work until your wish ..
0 Comments
Leave a Reply. |
AuthorProf. Ketan Sanjay Desale Archives
April 2020
Categories |