Beginner Array Program Help!!!

I am confused on how to go about this adding in all the required rules...please help!




Write a C++ program in a file called math.cpp that reads user values into two arrays. The user first enters the number of integers to be read. It computes and prints in equation form the sums, differences, products, and quotients for corresponding values of the two arrays. It then computes and prints the sum of all values in the two arrays.

You are required to define and use the following functions (size is a constant “big” integer):

// input reads “values” integers from the user to place in the array
// data. It prompts the user for each value individually with the ordinal
// position of the value.
void input (int data [size], int values);

// Places the sum of corresponding values from arrays a and b and places
// the results in array s. The first “values” integers in the array are
// processed. Note that do_sums does not print anything.
void do_sums (int a [size], int b [size], int s [size], int values);

// Places the differences of corresponding values from arrays a and b
// and places the results in array d. The first “values” integers in the array
// are processed. Note that do_differences does not print anything.
void do_differences (int a [size], int b [size], int d [size], int values);

// Places the products of corresponding values from arrays a and b
// and places the results in array p. The first “values” integers in the array
// are processed. Note that do_products does not print anything.
void do_products (int a [size], int b [size], int p [size], int values);

// Places the integer quotients of corresponding values from arrays a and b
// and places the results in array q. The first “values” integers in the array
// are processed. Note that do_quotients does not print anything.
void do_quotients (int a [size], int b [size], int q [size], int values);

// Prints in equation form the applying of the operator “op” to corresponding values
// in the a and b arrays and getting the result from the answer array. The equations
// are numbered. The first “values” integers in the array are processed.
void print (int a [size], int b [size], int answer [size], char op, int values);

// Computes and returns the sum of the “values” integers in the data1 and data2
// arrays.
int sum_of_all (int data1 [size], int data2 [size], int values);
What have you tried so far? It is difficult to offer help when you have not put forth any effort.

We won't do your assignment for you, but will help with problems you encounter while doing it.
You should really make a start for yourself, but here's a little help understanding your task.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
void input (int data [size], int values);
  // for "values" times
  //    ask the user for an integer
  //    add the integer to data[]
  //  end for

void do_sums (int a [size], int b [size], int s [size], int values);
  // for "values" times
  //    put the sum of a and b into s
  //  end for


void do_differences (int a [size], int b [size], int d [size], int values);
  // for "values" times
  //    put the difference of a and b into s
  //  end for

void do_products (int a [size], int b [size], int p [size], int values);
  // for "values" times
  //    put the product of a and b into s
  //  end for

void do_quotients (int a [size], int b [size], int q [size], int values);
  // for "values" times
  //    put the quotient of a and b into s
  //  end for

void print (int a [size], int b [size], int answer [size], char op, int values);
  // for "values" times
  //    print "a op b = answer"
  //  end for 

Topic archived. No new replies allowed.