Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Solve the following problems Write a user-friendly C++ program that allows a user to select repeatedly an operation to be performed from a displayed menu

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Solve the following problems Write a user-friendly C++ program that allows a user to select repeatedly an operation to be performed from a displayed menu of actions. The menu includes the following items 1 Overall Summation 2 Smallest Value 3 Standard Deviation 4 Euclidean Norm 5 Vector Subtraction 6 Exit The menu actions are described by the following points: Overall summation of values: This action includes finding the summation of a list of values. The option should allow the user to specify the name of a file from which the values are read into an array. All the results of this option are displayed on the screen. Smallest Value: This action allows the user to enter the name of a file from which two vectors, 17 and V2, of size N are read. Your program should find and display the smallest value in all the two vectors Standard Deviation: This action includes finding the standard deviation of a list of values. The option should allow the user to specify the name of a file from which the data are read into an array. All the results of this option are displayed on the screen Euclidean Norm: This action allows the user to enter the name of a file from which V7 vector of equal size size are read. Accordingly, the Euclidean Norm will be computed and displayed along on the screen Vector Subtract: This action allows the user to enter the name of a file from which two vectors, V/ and V2, of equal size are read. Accordingly, the two vectors are subtracted, and displayed along with the resultant vector on the screen. Your program should check that the two multiplied vectors are of the same size. Otherwise, the program should display a message and allow the user to make another choice from the menu Exit: This action terminates the program. Your program should include at least the following functions: A function, called Read Vector), which reads a vector of any size from a given file name, and returns the vector and its size to the caller. The function prototype is defined as follows: void ReadValues(double V[], int size, ifstrean Bintile) A function, called Display Menu), which displays the menu and returns the user's choice as an integer value between 1 and 5. The function prototype is defined as follows: int DisplayMaintenu(void); A function, called sam), which reads a vector of any size from a given file name, and returns the summation of the vector's values. The function prototype is defined as follows double sum(const double scores[], int vsize); The summation, mof N numbers X, X X sis A function, called Smallest alue), which finds the smallest value in two vectors, A and B. The function prototype is defined as follows: double smallestValue(const double A[], const double B[], int vsize); A function, called sideviation/),which reads a vector of any size from a given file name, and returns the standard deviation of the vector's values. The function prototype is defined as follows double stdeviation(const double scores[], int vsize, double ); The standard deviation, Sis (x,-m) N-1 A function, called Euclidean norm, which computes the Euclidean norm of vector returns the result, The function prototype is defined as follows: double Euclidean_norn(const double v[], int size): The Euclidean norm, V is In Evi A function, called Vector Substract), which performs the subtraction of two vectors, A and B, and retums the resultant vector, C. The function prototype is defined as follows: void Vector Substract(const double A[], const double B[], double C[], int vsize); The addition of two vectors, A=(1, 2,...,) and B = (bi, be.....be) of size n, is defined as: C-A-B Where. C-.C.....), and c-2.b, for Icicn Example input file "data.txt" a values.tot - File Edit Format View Help 4.2 13.3 5.6 17.6 7.4 2.1 9.8 2.1 10.3 6.7 Example Scenario: Select \Users... - X Main Menu 1. Overall Sunsation 2. Smallest Value 3. Standard Deviation 4. Euclidean Norm 5. Vector Addition 5. Exit Please Enter Your Selction: AUsers sarrab sourcevepos.... - O X Main Menu: 1. Overall Summation Smallest value 3. Standard deviation Fuclidean Nor Vector Addition 5. Exit Please Enter Your Selction: 1 Please enter the file name: values.txt Additioni 60.00 dUsers saab sourceveposl... - D X Main Menu: 1. Overall Summation 2. Sellest Value Standard Deviation Euclidean Nors 5. Vector Addition 2. Exit Please Enter Your Selction2 Please enter the file name: values.txt The smallest value isi 2.10 d arab repos Project Debug Projecte Main Menu 1. Overall Suation 2. Smallest Value 1. Standard deviation Euclidean Nora 5. Vector Addition Please Enter Your Selction: 5 Please enter the file name values.txt the vectors to have their vector Additionare Vector 11 4.20 11.30 5.60 17.0 2.40 2.10 9.80 Vector 212.10 10.30 6.70 8.10 11.40 12.10 19.40 vector addition result 6.30 23.60 12.30 25.70 18.0 14.20 20.20

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started