CSC 125



CSC 125 – Introduction to Computing
Assignment # 6
1. There is a game called “Bingo”, consisting of n levels. Hussain and Noura are addicted to the
game. Each of them wants to pass the whole game.
Hussain can pass only p levels of the game, whereas Noura can pass only q levels of the
game. You are given the indices of levels Hussain can pass and the indices of levels Noura
can pass. Will Hussain and Noura pass the whole game if they co-operate with each other?
Input
The first line contains T which represents the number of test cases 1  =  T = 100. Each test case
consists of the following: A line contains a single integer n (1 =  n = 100).
The next line contains an integer p (0 = p = n) at first, then follows p distinct integers
a1, a2, …, ap
 (1 = a  = n). These integers denote the indices of levels Hussain can pass. The
next line contains the levels Noura can pass in the same format. It’s assumed that levels are
numbered from 1 to n.
Output
If they can pass all the levels, print “BINGO”. If it’s impossible, print “OMG” (without the
quotes). The message of each test case should be printed on a separate line.
Sample Input
4
3 1 2 3
2 2 4
4
3 1 2 3
2 2 3
Sample Output
BINGO
OMG
 Note: In the first sample, Hussain can pass levels [1 2 3], and Noura can pass level [2 4], so
they can pass all the levels both. In the second sample, no one can pass level 4.
2. Implement the following class template: 
 Set
–  list: array<T>
+ input() : void 
+ output(): void
+ intersection(Set) : void
+ union(Set) : void
class Set has one data member (an array of a generic data type with size 10).  It also has the
following function members:
• input: which asks the user to enter the values of the set.
• output: which displays the values within the set
• intersection: which takes another Set object B as a parameter and displays the intersection
between the current Set and Set B.   
• union: which takes another Set object B as a parameter and displays the union between the
current Set and Set B. 
  
Write a C++ program which uses class Set to create 2 integer sets and 2 string sets. The program
Should ask the user to enter the inputs of all the sets. Then it finds the intersection and the union of the sets which have the same data type.
Before submitting your assignment, read the following instructions carefully:  
1. Submit neat and well organized C++ code(s) by adding comments to your code(s), giving the variables representative names and printing appropriate messages for the output.
2. The assignment should be uploaded to the portal (follow the TA’s instructions). Do NOT submit the assignment by email.
3. Assignments which are not uploaded to the portal will NOT be accepted.  
4. Give a representative name for your .cpp file “e.g. question1.cpp”.
5. Deadline is firm (11:55 pm of the due date). It will NOT be postponed.
6. Copied assignments will be evaluated to ZERO. 
7. Whenever you have any question or need any clarification, PLEASE ask ME or ask our TA.