Sei sulla pagina 1di 3

Programming 1 Final Machine Problem

Submission instructions:
Your CPP file name should follow this format:
Surname_FirstNameInitials_FinalMP
Email your CPP file to mjkp.23@gmail.com with the subject:
1C_FinalMP_YourFullName
You may only submit ONCE. Once you've submitted a file, that file will be
considered
as your final solution. So, triple-check your code before submitting.
Lastly, do not plagiarize and do not share your code! I have resources that
allow me
to easily detect plagiarized code. Trust me, plagiarizing will not do you any
good.
Karma will always be a bitch. I will divide the score for students who submitted
identical codes (e.g. if 4 students submitted the correct program but they have
identical codes, their scores will be 100/4 or 25!) So remember our rule: BE
HONEST.
Deadline of submission is on Friday, Oct 17 at 5PM.
**************************************************************************************
******************
Write a program that displays the following initial menu:
[A] Integer Module
[B] String Module
[C] Exit program
Enter choice:
If the user selected either choice A or B, the program will prompt the user to
input a positive
integer value n which will determine the number of elements (integer type for
A; string for B)
the user has to input.
The program then prompts the user to input n elements and stores them in an
array with a
maximum size of 50. After the input of elements, the program will display the
selected

modules menu. Regardless of the module chosen, the module menu should
have the
following options:
[1] Search an element
[2] Display elements
[3] Insert an element
[4] Delete an element
[5] Edit an element
[6] Sort elements
[7] Shuffle elements
[8] Back to main menu
Enter choice:
If option 1 is selected, the program should ask for the element to be searched.
If the
element is found, its position number (index+1) is displayed (e.g. element is
found at position 1). Otherwise, an error message is displayed. If there are
identical elements stored
in the array, all of their position numbers should be displayed individually.
If option 2 is selected, the program should display all the elements currently
stored in the
array together with their corresponding position number (index+1). If this
option is selected
prior to selecting option 6, the elements will be displayed unsorted. If option 6
was
previously selected, the elements will be displayed sorted.
If option 3 is selected, the program should ask for the value to be inserted and
the position
number to which the value is to be inserted. The value is then inserted at the
specified
position thereby increasing the number of elements currently stored in the
array.
If option 4 is selected, the program should ask for the element to be deleted. It
uses the
search routine to search for the element to be deleted. If found, the element is
then deleted;

decreasing the number of elements in the array. If not found, an error message
is displayed.
If option 5 is selected, the program should ask for the position number. Using
the search
routine, the program displays the current element stored in the position
number specified. It
then prompts the user for the new element to replace the original element
stored in the
position number specified.
If option 6 is selected, the program should ask whether the elements are to be
sorted in
ascending or descending order. Using the display routine, the program then
displays the
elements in the order specified.
If option 7 is selected, the program should shuffle the elements in the array.
Using the
display routine, the program then displays the elements in their new
arrangement. The
better the shuffling algorithm, the higher the grade.
If option 8 is selected, the program goes back to the main/initial menu.
Every after routine execution, the program displays the MODULE MENU.
The program exits only when choice C is selected from the main menu.

Potrebbero piacerti anche