hello every one

i need yr help to solve this c++ -Home Assignment ..

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. Simple Statistics

2. Vector Addition

3. Dot Product

4. Exit

The menu actions are described by the following points:

Simple Statistics: This action includes finding the average, and standard deviation of a list of data items. 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.

Vector Addition: This action allows the user to enter the name of a file from which two vectors, V1 and V2, of equal size N are read. Accordingly, the two vectors are added, and displayed along with the resultant vector on the screen. Your program should check that the two added vectors are of the same size. Otherwise, the program should display a message and allow the user to make another choice from the menu.

Dot Product: This action is similar to the Vector Addition in terms of input, output, and checking validity of the vector operands.

Exit: This action terminates the program.

Your program should include at least the following functions:

1. A function, called ReadVector(), 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 ReadVector(double V[], int &size, ifstream infile);

2. A function, called DisplayMenu(), which displays the menu and returns the user’s choice as an integer value between 1 and 4. The function prototype is defined as follows:

int DisplayMenu (void);

3. A function, called VectorAdd(), which performs the addition of two vectors, A and B, and returns the resultant vector, C. The function prototype is defined as follows:

void VectorAdd(const double A[], const double B[], double C[], int size);

The sum of two vectors, A = (a1, a2, …, an) and B = (b1, b2, …, bn) of size n, is

defined as: C = A + B.

Where, C = (c1, c2, …, cn), and ci = ai + bi, for1 i n .

4. A function, called DotProduct(), which performs the dot product of two vectors, A

and B, and returns the result. The function prototype is defined as follows:

void DotProduct(const double A[], const double B[], int size, double &result);

The dot-product of two vectors A = (a1, a2, …, an) and B = (b1, b2, …, bn) of size n

is defined as

n n

n

i

i i b a ....... b a b a b a B . A

1 1 2 2

1

5. A function, called Simple_Stat(), which finds the maximum, minimum, average,

and standard deviation of a list of data items passed to it by a one-dimensional

array. The function returns the average and standard deviation values. The function

prototype is defined as follows:

void Simple_Stat(const double list[], int size, double &average, double

&std_dev);

i need yr help to solve this c++ -Home Assignment ..

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. Simple Statistics

2. Vector Addition

3. Dot Product

4. Exit

The menu actions are described by the following points:

Simple Statistics: This action includes finding the average, and standard deviation of a list of data items. 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.

Vector Addition: This action allows the user to enter the name of a file from which two vectors, V1 and V2, of equal size N are read. Accordingly, the two vectors are added, and displayed along with the resultant vector on the screen. Your program should check that the two added vectors are of the same size. Otherwise, the program should display a message and allow the user to make another choice from the menu.

Dot Product: This action is similar to the Vector Addition in terms of input, output, and checking validity of the vector operands.

Exit: This action terminates the program.

Your program should include at least the following functions:

1. A function, called ReadVector(), 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 ReadVector(double V[], int &size, ifstream infile);

2. A function, called DisplayMenu(), which displays the menu and returns the user’s choice as an integer value between 1 and 4. The function prototype is defined as follows:

int DisplayMenu (void);

3. A function, called VectorAdd(), which performs the addition of two vectors, A and B, and returns the resultant vector, C. The function prototype is defined as follows:

void VectorAdd(const double A[], const double B[], double C[], int size);

The sum of two vectors, A = (a1, a2, …, an) and B = (b1, b2, …, bn) of size n, is

defined as: C = A + B.

Where, C = (c1, c2, …, cn), and ci = ai + bi, for1 i n .

4. A function, called DotProduct(), which performs the dot product of two vectors, A

and B, and returns the result. The function prototype is defined as follows:

void DotProduct(const double A[], const double B[], int size, double &result);

The dot-product of two vectors A = (a1, a2, …, an) and B = (b1, b2, …, bn) of size n

is defined as

n n

n

i

i i b a ....... b a b a b a B . A

1 1 2 2

1

5. A function, called Simple_Stat(), which finds the maximum, minimum, average,

and standard deviation of a list of data items passed to it by a one-dimensional

array. The function returns the average and standard deviation values. The function

prototype is defined as follows:

void Simple_Stat(const double list[], int size, double &average, double

&std_dev);

Topic archived. No new replies allowed.