CS201 Assignment No 2 Solution - Spring 2019

CS201 Assignment No 2 Solution - Spring 2019

Write a menu based system in C++ that will take input from user for the following menu. You will create an array. And perform the following operations on the array.




Press 1 To Enter Values In Array.

Press 2 To Read Array Elements.

Press 3 To Show Array Elements In Reverse Order.

Press 4 To Show Array Elements Which Are Multiples Of 3.

Press 5 To Show Sum Of All The Elements.

Press 6 To Exit.

           

Solution Instructions:

è Use switch statement for the menu based system.

èYou have to use pointers for option 2, 3, 4, 5.

èYou can use user defined functions for each of the task mentioned above to manage your code.



To Enter Values In Array
getValues();
To Read Array Elements
displayArray();
To Show Array Elements In Reverse Order
reverseArray();
To Show Array Elements Which Are Multiples Of 3.
multipleOf3();
To Show Sum Of All The Elements
sumOfElements();



If the user chooses any option other than 1, for the first time, when array is empty, so the user will get a message

Array is empty, first enter data in array" as shown in the sample output.



To get solution please comment.