Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Program I have a list of numbers that I need to know two things, what numbers I have in the list and how many

C++ Program

I have a list of numbers that I need to know two things, what numbers I have in the list and how many of each number do I have in the list. So you are to read in each number and add the number to an ordered link list. Now, if you are adding a number to the list and you find that number, then you will just count it. If you do not find the number in the link list, then you will add a new node to the link list with the new number and set the count to one.

The structure/class will have three fields; the number, a counter, the counter is used to keep count of how many of this number exist and of course a linkfield.

1. Print out the values and their counts say 8 per line.

Example 5 22 8 15 13 5 22 3 25 18 where the 5 is the number and 22 is its count (ie there were 22 number 5s in the list). Label output please.

2. Print out the number of nodes in the link list.

3. Now, go through the link list and delete any node with any value that is a multiple of 7.

4. Print out the number of nodes in the new link list.

5. Travers the new link list and print out the number of values in the list and the average.

Input file is LinkNbrs.dat.

LinkNbrs.dat file

2 28 15 21 10 5 39 39 3 25 26 26 2 28 2 12 36 23 28 37 32 5 23 34 13 23 22 37 39 16 8 7 12 19 30 33 28 20 36 15 24 12 3 14 34 25 22 32 14 29 28 5 23 38 38 20 4 22 10 19 37 36 31 3 9 27 1 23 25 9 7 6 11 10 11 31 7 22 34 29 30 24 5 35 37 1 7 17 12 29 25 40 27 4 18 19 39 3 10 22 34 36 40 19 25 11 18 27 34 27 22 26 5 33 31 30 18 14 18 33 27 11 2 37 36 8 16 15 32 13 31 31 22 5 7 31 28 32 8 18 18 8 34 24 26 30 10 39 22 29 23 27 27 31 14 9 21 32 3 16 11 40 25 18 29 4 36 2 3 31 12 37 15 21 37 22 29 40 29 5 2 15 14 40 19 19 21 29 8 28 9 14 9 4 8 22 31 18 14 35 30 17 16 12 1 10 40 37 39 24 25 9 5 10 30 23 36 6 14 24 4 28 35 24 9 1 19 19 21 37 39 2 30 39 10 38 33 23 19 13 39 20 31 18 39 32 16 9 37 32 3 35 33 16 9 7 3 7 36 34 30 23 5 17 2 39 3 12 22 20 38 37 13 30 36 33 1 31 4 30 22 9 2 30 16 24 3 26 23 6 9 27 18 38 33 13 10 35 2 30 17 10 9 13 26 36 35 30 2 33 26 21 39 34 20 24 40 37 8 10 30 38 27 30 34 36 18 17 7 26 9 3 16 15 35 22 37 32 27 24 34 36 26 14 33 9 33 26 34 37 2 39 7 23 2 25 37 23 10 2 16 11 14 27 5 20 13 40 14 25 35 31 26 10 27 34 35 23 9 19 28 26 39 32 3 26 38 15 35 25 15 35 13 40 34 31 8 18 39 18 14 31 4 29 33 26 23 1 14 28 3 20 8 26 24 5 24 13 22 22 4 33 26 34 6 32 13 23 23 7 25 21 28 1 14 15 31 11 36 34 32 1 17 28 6 31 21 15 16 25 20 6 17 15 19 23 12 27 39 34 12 5 19 25 40 33 1 8 21 7 11 38 11 36 17 28 4 39 5 30 3 7 6 8 18 35 26 28 30 9 24 1 23 3 4 37 18 22 36 6 25 21 3 37 31 7 12 12 12 28 34 1 31 5 29 4 21 12 23 30 21 34 39 19 6 8 38 1 19 40 24 1 38 5 38 29 34 8 2 11 21 29 34 25 6 21 32 25 36 37 33 31 24 6 37 17 27 38 7 38 18 32 30 2 17 23 18 33 38 17 26 2 24 10 30 6 40 13 17 16 14 3 25 15 15 13 18 10 13 4 8 4 32 36 28 9 36 19 24 23 35 32 22 16 20 26 22 31 27 15 6 24 11 39 40 22 34 15 38 15 37 34 17 26 3 29 2 21 14 2 16 16 23 23 12 38 25 39 33 4 17 34 1 34 36 33 19 11 18 13 33 16 10 32 1 9 6 11 18 30 31 26 34 35 12 21 5 19 16 40 33 6 25 22 24 30 16 9 13 38 30 37 2 28 28 22 10 1 14 15 2 38 16 4 14 33 25 2 33 40 31 29 28 5 36 27 19 11 8 8 5 24 22 24 27 4 11 12 10 1 5 23 20 34 32 25 19 33 31 6 16 20 24 23 19 8 25 9 12 25 34 36 26 33 27 39 10 23 40 26 10 25 26 21 6 29 39 31 2 4 13 33 33 8 11 4 22 24 24 8 1 10 16 6 29 24 28 9 24 38 10 24 10 2 29 23 9 21 22 39 35 9 27 11 30 4 31 21 29 28 17 24 36 27 26 39 14 30 25 29 4 40 18 7 25 36 39 7 12 26 36 2 30 17 25 36 5 23 36 34 23 37 29 33 27 7 14 30 5 26 27 13 16 14 6 37 17 22 15 35 17 13 17 39 3 36 16 12 31 2 26 12 38 27 11 11 23 35 14 34 17 13 9 23 34 15 24 35 24 17 29 5 38 14 30 29 1 1 39 19 11 36 2 25 24 37 4 30 23 2 10 29 3 14 35 21 3 4 32 10 39 20 9 20 12 4 26 22 25 33 6 34 19 30 3 19 38 11 22 35 29 2 40 14 36 30 18 30 19 21 12 25 38 16 36 16 11 40 13 9 3 35 6 31 5 15 21 16 32 22 36 40 31 19 34 29 18 13 37 10 34 9 22 31 4 4 29 25 19 1 32 6 15 32 14 28 34 16 9 26 37 30 11 39 30 14 7 1 37 10 28 9 40 25 22 6 27 17 37 7 27 8 2 5 21 7 22 23 2 25 30 16 23 34 5 22 26 3 24 12 7 29 39 3 28 28 2 13 17 31 35 10 5 37 11 14 37 33 15 26 29 9 12 33 12 35 40 39 3 25 36 13 30 40 39 24 39 27 20 19 7 37 23 34 39 23 27 33 38 6 8 19 3 8 19 31 13 1 39 40 33 9 3 21 36 16 3 8 17 38 19 18 29 12 17 31 10 6 19 30 1 21 1 28 3 16 36 33 2 35 39 27 35 27 29 10 39 24 36 36 2 36 16 9 35 11 26 25 38 3 2 5 30 30 11 4 31 14 6 31 18 17 18 39 34 37 35 5 32 30 16 26 18 5 18 24 25 11 9 9 2 6 33 14 13 35 37 27 37 13 10 1 15 20 24 12 22 10 20 6 6 26 17 11 16 10 25 7 14 35 30 21 16 14 30 2 13 9 39 32 29 27 31 23 15 20 31 33 23 32 16 5 35 5 23 16 21 35 13 22 3 28 18 30 6 36 35 31 24 35 2 13 33 40 29 33 3 8 9 16 29 24 40 35 5 7 40 39 26 7 7 21 8 13 28 13 37 15 8 22 4 23 12 17 24 29 4 23 19 17 21 32 23 17 11 6 5 7 38 10 4 15 38 29 29 32 37 24 29 8 27 32 18 13 24 28 9 26 29 26 39 38 4 34 22 11 9 32 11 30 33 15 30 2 26 28 34 34 35 33 13 31 22 3 18 38 11 23 5 22 31 24 38 24 20 36 10 8 3 31 23 19 7 8 31 9 12 19 14 21 24 7 23 11 33 9 35 2 39 24 28 26 19 2 18 31 15 39 19 22 24 37 8 39 10 36 6 36 27 27 34 1 11 9 9 13 34 1 7 16 11 40 38 13 23 9 33 10 5 35 9 13 8 33 16 9 25 18 4 10 16 2 30 21 13 9 4 12 35 34 12 1 15 31 18 40 21 19 12 25 21 8 20 6 4 19 13 34 13 12 1 35 1 18 26 10 21 6 32 33 11 30 19 20 12 38 34 34 21 18 27 37 31 23 19 40 19 10 40 10 5 33 21 9 8 9 38 24 11 8 37 35 3 12 20 2 17 11 4 4 37 13 13 22 35 14 23 37 21 16 25 40 17 1 39 33 28 25 1 38 7 31 2 3 10 4 39 26 22 16 17 37 39 19 20 19 18 31 8 10 2 36 39 37 34 20 25 6 14 9 13 4 10 35 9 16 32 14 3 29 12 27 25 7 18 38 30 37 35 32 30 33 27 14 12 16 30 18 1 13 37 32 8 27 3 36 24 35 21 18 26 26 34 22 19 39 39 21 12 28 6 11 16 10 31 30 14 26 15 3 8 33 17 8 3 3 11 2 32 28 26 40 2 19 32 8 9 7 37 40 30 23 27 7 16 29 15 21 14 18 29 24 22 32 3 16 38 27 33 22 17 2 22 16 28 5 39 16 17 15 20 39 35 14 3 36 4 9 34 33 28 1 7 39 11 2 2 40 16 4 37 14 2 6 34 35 31 34 22 8 20 31 4 26 13 10 22 33 37 22 8 11 32 6 13 33 30 1 6 32 19 14 7 19 29 7 12 7 37 18 21 15 10 29 30 25 10 19 18 16 27 5 9 27 9 18 39 31 40 26 7 40 21 31 32 14 16 6 39 21 12 28 28 5 27 28 1 28 35 32 33 32 29 14 6 18 32 5 38 7 9 23 14 1 23 18 39 29 36 10 8 22 14 25 28 2 14 18 22 3 8 26 34 25 5 16 6 22 5 22 33 27 17 24 34 1 1 29 12 34 9 12 17 40 9 1 12 14 20 24 20 14 17 16 6 35 1 36 1 17 16 6 32 9 40 37 3 33 26 1 16 3 6 3 1 37 38 3 29 1 21 37 19 14 21 27 35 14 18 1 16 33 1 28 36 27 22 29 2 9 36 37 26 10 13 17 16 3 4 23 22 3 33 9 19 9 38 35 11 11 16 40 10 16 24 1 20 40 26 32 22 2 13 34 34 30 28 3 14 4 21 15 39 5 24 30 13 25 10 31 6 8 35 8 7 37 4 21 40 31 29 31 32 26 22 31 24 30 36 19 20 7 23 16 8 37 34 9 16 20 34 31 3 6 2 26 8 8 30 15 32 18 39 26 38 19 39 5 13 4 29 25 2 4 11 5 2 28 38 13 12 4 22 4 2 6 22 6 11 16 22 23 13 32 16 16 34 19 40 3 9 15 23 28 6 19 25 11 20 35 5 24 26 39 5 22 11 14 24 35 11 7 28 6 6 17 31 10 19 4 16 18 10 31 25 29 18 35 1 13 14 16 15 2 17 7 25 36 23 40 22 33 5 20 40 4 28 37 6 39 18 29 40 18 18 12 37 36 21 22 34 33 17 21 36 28 25 35 40 31 37 2 32 10 11 15 33 32 30 28 11 40 14 14 24 2 24 6 17 40 16 20 29 39 4 40 36 22 34 27 3 39 29 22 40 19 12 24 24 35 4 30 23 28 23 22 8 27 12 38 14 1 17 11 3 16 7 11 38 23 21 30 26 35 24 3 36 7 1 39 29 12 6 28 26 28 30 23 24 28 23 18 20 24 27 4 9 12 11 37 19 8 17 6 12 3 20 16 37 12 16 5 32 4 29 36 11 40 33 32 24 14 16 3 10 21 35 39 26 18 14 14 11 24 31 34 3 32 12 31 19 2 19 8 33 19 40 23 4 31 3 9 23 16 16 9 2 23 35 20 29 19 3 38 22 8 30 26 21 34 5 31 22 26 34 25 23 24 23 30 35 10 33 35 30 11 5 5 10 39 26 4 33 14 31 12 28 32 30 39 19 24 33 40 14 4 3 9 4 35 11 23 1 32 13 12 21 38 17 37 19 21 16 29 39 20 36 18 4 23 23 23 21 11 23 34 2 7 9 38 38 13 19 28 30 26 30 13 20 2 4 11 29 32 30 33 31 13 25 8 16 29 2 11 11 18 32 37 20 4 1 34 38 14 31 35 34 23 4 22 11 23 28 38 32 24 11 38 1 24 7 4 22 20 6 27 12 6 2 1 10 18 4 11 19 22 16 22 28 32 8 40 25 20 19 21 11 22 39 6 21 29 20 23 39 1 19 16 2 15 8 14 37 2 27 19 31 19 37 36 38 12 1 33 39 34 16 26 7 2 35 40 34 29 34 33 34 14 18 24 11 12 15 29 28 19 30 9 40 8 30 12 30 36 39 10 37 40 4 4 12 35 22 35 26 8 17 34 25 27 34 29 24 5 33 28 9 30 11 12 15 11 28 24 5 40 35 36 27 39 30 19 10 10 8 1 19 5 16 27 10 24 27 13 1 11 37 36 2 27 12 30 28 4 6 31 11 7 36 22 9 23 38 23 25 6 33 33 6 29 7 10 39 4 6 26 21 6 19 22 16 1 8 14 15 12 36 17 15 2 18 31 15 31 37 32 1 16 26 3 26 39 14 33 38 39 26 3 38 13 20 8 27 24 32 36 40 19 30 6 35 40 6 33 36 23 33 14 1 39 18 23 9 4 38 6 15 2 39 23 10 17 39 20 19 2 27 24 38 16 5 22 21 2 23 3 9 16 5 17 18 28 34 5 25 20 22 19 4 29 38 40 18 2 12 25 24 36 33 10 2 36 16 17 38 40 21 13 14 2 30 9 28 39 25 5 35 14 6 39 11 23 30 5 30 39 4 6 1 25 34 26 13 6 8 8 38 25 25 31 35 12 22 6 15 31 23 39 7 19 22 25 38 17 15 30 29 8 14 29 7 23 39 1 20 39 11 25 20 37 9 33 39 15 28 40 35 21 28 35 29 2 39 3 3 2 25 27 17 30 34 29 2 14 7 5 26 23 3 21 2 21 24 19 28 34 24 32 15 16 17 2 13 12 40 12 19 11 5 28 8 25 32 22 10 39 2 31 14 13 16 21 14 33 3 37 24 14 27 12 36 9 13 2 30 24 10 28 13 12 34 33 11 40 33 8 15 26 1 24 23 10 8 39 1 32 12 15 28 35 4 30 10 7 8 37 33 31 20 27 3 4 1 34 26 12 20 27 8 30 3 38 6 37 29 13 35 27 34 1 40 32 19 28 17 19 35 1 14 8 30 17 3 3 8 24 21 28 34 31 38 4 17 35 27 38 15 21 12 33 5 35 27 14 25 16 1 13 21 32 37 20 24 38 30 2 26 33 35 25 2 4 25 27 9 29 38 31 4 25 35 27 38 22 39 12 13 32 33 4 22 32 22 11 19 10 12 1 20 38 38 35 36 2 17 28 29 14 30 14 22 24 10 17 4 8 26 3 31 38 2 8 31 27 8 12 38 6 5 39 32 8 36 33 32 18 6 14 12 21 21 11 36 1 31 18 39 27 5 10 32 25 29 11 39 40 20 8 10 40 40 37 21 37 14 19 31 34 7 10 15 33 1 15 15 14 27 30 32 29 40 2 22 9 7 34 6 31 10 22 21 9 23 3 27 39 20 18 8 19 30 24 21 36 27 34 30 38 38 15 14 16 19 34 4 14 27 32 21 15 18 15 33 18 32 16 18 13 13 38 11 14 17 31 30 29 10 27 25 1 23 10 1 34 13 3 15 8 8 35 26 34 12 34 14 25 4 36 3 22 27 30 9 9 25 32 35 36 8 34 1 23 8 18 18 21 23 21 1 39 37 35 16 31 32 16 18 24 3 8 30 12 12 35 1 14 14 2 26 9 4 1 36 32 31 13 16 32 1 15 1 27 35 9 20 6 37 33 23 13 12 28 25 38 9 37 11 11 23 22 14 20 13 5 12 36 5 11 27 27 19 2 24 4 2 21 16 39 20 4 29 10 9 15 14 20 10 27 40 18 38 3 36 13 4 33 9 4 34 29 36 38 29 29 12 34 26 22 3 11 29 17 26 6 24 10 36 14 6 5 39 26 1 34 6 21 9 35 34 6 29 2 33 17 31 33 23 22 27 36 21 32 8 18 24 9 34 36 12 4 23 12 40 35 33 34 11 2 35 19 7 27 32 4 29 28 40 5 25 14 36 25 15 23 28 28 6 27 7 30 21 38 11 40 19 37 38 4 3 21 12 26 24 36 17 16 5 7 9 2 16 19 6 34 24 33 19 18 37 20 7 15 7 4 3 32 1 16 39 8 31 31 34 8 14 15 17 33 11 2 2 7 6 14 25 10 16 4 35 34 28 28 1 40 2 6 15 21 1 28 22 13 14 38 38 4 24 14 40 12 6 29 19 29 11 13 5 15 24 34 37 28 27 27 22 25 39 12 7 6 20 17 9 28 32 20 32 7 38 7 14 28 22 33 28 20 5 18 2 9 23 25 9 9 2 17 23 1 5 39 26 20 25 15 25 20 30 15 16 24 33 12 18 15 4 12 20 11 38 4 39 25 13 27 30 9 18 38 25 9 28 29 34 23 32 30 14 38 15 25 5 24 16 12 14 13 39 31 20 11 14 35 30 15 35 14 30 19 26 34 39 32 13 24 29 30 9 6 32 1 27 32 9 22 19 38 8 23 39 3 4 27 27 30 37 26 32 4 39 31 18 37 32 7 31 14 12 1 5 24 22 6 19 30 26 35 26 28 25 5 37 38 28 36 23 7 29 19 20 12 10 39 11 16 11 13 10 17 31 33 3 10 33 37 38 34 17 31 6 13 32 38 32 2 36 14 33 37 37 9 32 6 39 17 20 25 17 27 23 39 29 22 27 29 18 29 20 28 30 1 6 9 23 27 40 38 12 8 26 32 7 5 35 10 30 37 22 26 26 17 21 18 16 31 38 10 6 7 29 36 24 18 11 8 36 3 14 1 35 10 9 16 9 31 21 40 38 28 15 25 38 6 20 33 14 13 3 24 32 10 18 34 1 25 4 18 9 31 9 29 2 13 38 5 20 22 30 24 17 13 1 8 13 11 21 36 24 16 18 38 15 15 34 14 39 7 25 15 36 30 33 25 25 33 25 23 16 34 23 34 5 1 3 14 38 23 31 18 38 7 12 38 26 37 38 40 11 19 26 8 5 33 6 37 16 29 19 23 29 36 23 38 27 8 14 34 26 27 10 5 15 26 40 7 10 13 20 16 37 22 8 19 14 8 33 17 30 2 11 11 35 36 7 4 27 25 17 38 17 14 30 12 5 18 6 1 31 6 6 39 29 7 10 9 22 26 17 21 37 31 25 28 9 17 5 21 4 5 12 1 11 25 4 7 22 31 6 27 9 17 28 27 18 39 40 35 36 32 31 33 19 37 38 11 8 28 35 7 23 3 40 27 16 27 35 31 27 40 17 23 40 22 13 37 5 38 11 39 33 25 2 21 1 4 17 22 8 20 9 11 13 20 19 20 8 5 28 18 36 14 30 12 3 20 17 22 22 35 10 39 37 30 18 25 39 3 26 39 33 26 37 2 20 24 8 12 34 23 21 17 9 40 30 34 20 12 32 4 5 39 13 25 40 22 15 14 20 35 10 36 3 22 17 18 13 6 12 19 31 8 16 28 25 23 40 2 9 5 35 9 2 33 29 15 17 18 34 2 26 19 16 15 13 7 37 5 7 22 25 1 15 17 37 28 6 19 12 2 26 32 32 20 21 18 17 24 25 25 26 38 23 27 36 7 33 30 7 26 4 33 22 7 34 25 10 31 6 27 26 11 17 36 34 4 13 17 17 11 17 13 31 11 36 13 31 36 37 2 1 25 10 15 11 3 7 17 25 31 18 23

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The World Wide Web And Databases International Workshop Webdb 98 Valencia Spain March 27 28 1998 Selected Papers Lncs 1590

Authors: Paolo Atzeni ,Alberto Mendelzon ,Giansalvatore Mecca

1st Edition

3540658904, 978-3540658900

More Books

Students also viewed these Databases questions

Question

1. Define mass and mediated communication

Answered: 1 week ago