Question: Write a C++ program (or Java program) called hw1_2.cpp (or hw1_2.java) that reads two groups of numbers in which each group has several integer numbers

Write a C++ program (or Java program) called hw1_2.cpp (or hw1_2.java) that reads two groups of numbers in which each group has several integer numbers without duplicates. Your program should display the non-common numbers in both groups in descending order.

Input format: This is a sample input from a user.

5

7

20

8

-7

15

3

8

14

7

The first number (= 5 in the example) indicates that there are five numbers in the first group. Then, the numbers from the second line (= 7 in the example) to the sixth line (15 in the example) are actual numbers of the first group.

The following number (= 3 in the example) indicates that there are three numbers in the second group which are 8, 14, and 7.

For the input, your program should present the non-common numbers in both groups in descending order. Note that both 7 and 8 are common numbers in the two groups. Thus, you have to display the non-common numbers (= 20, 15, 14, -7) in descending order on the screen. If theres a non-common number, your program should display NONE.

Sample Run 0: Assume that the user typed the following lines.

5

7

20

8

-7

15

3

8

14

7

This is the correct output of your program.

Answer:20 15 14 -7

Sample Run 1: Assume that the user typed the following lines.

3

5

-5

0

3

-5

0

5

This is the correct output of your program.

Answer:NONE

Sample Run 2: Assume that the user typed the following lines.

5

3

-5

4

2

7

4

2

7

4

-5

This is the correct output of your program.

Answer:3

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!