CS 201-01-13F Programming In C++ Program 3




5/5 - (6 votes)

Create a folder called “PG3” in the top level of your CS201-01-13F folder. Place all files
pertaining to this assignment into that folder. Place a (possibly empty) file called “DONE” into
this folder when you are ready to have your programs graded. The only files you need to turn in
are the .cpp and the .h files.
Write the following program in C++:
You are to read integers one at a time from the keyboard until the user enters a blank line instead
of an integer. You may assume all integers are valid and fit into a int variable (except for the
blank line at the end.) You are then to print out how many of each integer were entered. Here’s
the thing, though. You are not allowed to use arrays. You must store your information in a
linked list. Make sure that your program contains no memory leaks.
Enter integer 1: 5
Enter integer 2: 0
Enter integer 3: -3
Enter integer 4: 0
Enter integer 5: 6
Enter integer 6: 0
Enter integer 7: 5
Enter integer 8: 9
Enter integer 9: 1000000
Enter integer 10: 0
Enter integer 11:
There are 1 elements with value -3.
There are 4 elements with value 0.
There are 2 elements with value 5.
There are 1 elements with value 6.
There are 1 elements with value 9.
There are 1 elements with value 1000000.