Question: Objectives: Review C++ Part I (control flows, array/vector, string processing) Exercise Summary: For this exercise, you are to introduce a program that shows a menu

Objectives:

  1. Review C++ Part I (control flows, array/vector, string processing)

Exercise Summary:

For this exercise, you are to introduce a program that shows a menu of functions/activities that you want user to choose from. The menu will continue to ask for which function to invoke until inputting -1. Also, implement all the functions.

If input is 1: call int findMin(int a[], int size) function. This will return the minimum value of integer array a. size is the length of the array. You may use vector if you prefer. If you use vector, your function should be declared as int findMin(vector a).

If input is 2: call double computeAvg(int a[][a const value of # column], int row, int column) function. This function will compute the average of all elements in a two-dimensional array. If you want to use vector, your function should be declared as int double computeAvg(vector> a). Please randomly generate contents of array/vector.

If input is 3: call bool isLeapYear(int year) function. This function will return true if year is leap year. Otherwise, it will return false. https://en.wikipedia.org/wiki/Leap_year

If input is 4: call int calculate(string exp) function. This function will return the computation of a string expression (exp). For example:

calculate(54321+222) will return 54543

calculate(120*20) will return 2400

calculate(235/3) will return 78

calculate(356-32) will return 324

If input is 5: call void getFileContent(string filename, vector& words). This function will read a text file and store each word into a vector of string. You have flexibility to determine the input parameter(s) and output type of the function.

If input is 6: call void frequencyCount(vector& words, .). This function will read the vector of string and count the frequency of each word. You have flexibility to determine the input parameter(s) and output type of the function.

For example, words = {Dhanyu, is, a, handsome, professor, Dhanyu, is professor};

Then the frequency of Dhanyu, is, and professor are all 2. The rests frequency are all 1.

If input is 7: call stopWordRemoval(vector& words,). This function will remove all the stop words from words, where stopwords= {a, an, the, i, we, they};

If input is -1: jump out the menu. Note that the menu should continuously take inputs until -1 is input.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!