CS12 Program 1
Posted:
October 5th, 2001
Due:
October 15th, 2001
This program serves as a proficiency test for entering the course. It only relies on material learned in CS10, which is a prerequisite for this course. If you can write this program correctly, then there is a good likelihood that you are ready for this course, and you earn some easy points towards your grade. If you have a lot of trouble with this, you are looking at a rocky road ahead, and while you are certainly welcome to continue in the course, be aware that you may not have an easy time.
Write a menu driven program that will keep track of a list of up to 10 integers, stored in an array. The program should allow the user to add numbers to the list (if there is room), print the list, and search the list for a number. Each of these three operations should be in a separate function. The search function should return a value that reflects whether or not the number is in the array.
A sample run of the program might look like this:
Welcome
to the Simple List program. You may
store up to 10 integers in the list.
Please select from the menu:
a – Add a
number to the list
p – Print
the list
s –
search the list
a
Please
enter the number to add
13
13 added
to the list!
Please
select from the menu:
a – Add a
number to the list
p – Print
the list
s –
search the list
a
Please
enter the number to add
8
13 added
to the list!
Please
select from the menu:
a – Add a
number to the list
p – Print
the list
s –
search the list
p
The list
is
13 8
Please
select from the menu:
a – Add a
number to the list
p – Print
the list
s –
search the list
s
Please
enter the number to look for
2
2 is not
in the list!
Please
select from the menu:
a – Add a
number to the list
p – Print
the list
s –
search the list
s
Please enter
the number to add
8
8 is in
the list!
One file, called simpleList.cpp, containing your program.