Functions and Arrays as Parameters

Can anyone tell me what "int values" is supposed to mean as parameters to these functions? I'm not sure what do with them.
Also i have no idea how to input values into the array via functions. I was trying to but I just don't understand how to connect a user's input to a function to then enter into an array.


// 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.
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.
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.
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.
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);



#include <cstdlib>
#include <iostream>

using namespace std;

const int size = 3;
const int value = 3;
void input (int data [size], int values);
void do_sums (int a [size], int b [size], int s [size], int values);
void do_differences (int a [size], int b [size], int d [size], int values);
void do_products (int a [size], int b [size], int p [size], int values);
void do_quotients (int a [size], int b [size], int q [size], int values);
void print (int a [size], int b [size], int answer [size], char op, int values);
int sum_of_all (int data1 [size], int data2 [size], int values);

int main(int argc, char *argv[])
{
//Variables
int howMany, v;
int a[size];
int b[size];
int s[size];
int d[size];
int p[size];
int q[size];


cout<<"Enter the number of data values: ";
cin>> howMany;

//Prompt user for data for first array
cout<<" "<<endl;
cout<<"Enter first set of data: "<<endl;
cout<<"Enter value 1: ";
input(a, 3);
cout<<"Enter value 2: ";
input(a, 3);
cout<<"Enter value 3: ";
input(a, 3);


//Prompt user for data for second array
cout<<" "<<endl;
cout<<"Enter second set of data: "<<endl;
cout<<"Enter value 1: ";
input(b, 3);
cout<<"Enter value 2: ";
input(b, 3);
cout<<"Enter value 3: ";
input(b, 3);

//Sums of values
cout<<" "<<endl;
do_sums( a, b, s, 3);
cout<<"The sums are: "<<endl;
print(a, b, s, '+', 3);

//Differences of values
cout<<" "<<endl;
do_differences(a, b, d, 3);
cout<<"The differences are: "<<endl;
print(a, b, d, '+', 3);

//Products of values
cout<<" "<<endl;
do_products(a, b, p, 3);
cout<<"The products are: "<<endl;
print(a, b, p, '*', 3);

//Quotients of values
cout<<" "<<endl;
do_quotients(a, b, q, 3);
cout<<"The quotients are: "<<endl;
print(a, b, q, '/', 3);

//Total sum
// cout<<" "<<endl;
//sum_of_all();
//cout<<"The total sum is: "<<endl;
//print();







system("PAUSE");
return EXIT_SUCCESS;
}

void input (int data [size], int values)
{
int i;
int userInput;

for (int i = 0; i < value; i ++)
{
cin >> userInput;
userInput = data[i];
}
}

void do_sums (int a [size], int b [size], int s [size], int values)
{
int i;

for (i = 0; i < 3 ; i++)
s[i] = a[i] + b[i];
}

void do_differences (int a [size], int b [size], int d [size], int values)
{
int i;

for (i = 0; i < 3; i++)
d[i] = a[i] - b[i];
}

void do_products (int a [size], int b [size], int p [size], int values)
{
int i;

for (i = 0; i < 3; i++)
p[i] = a[i] * b[i];
}

void do_quotients (int a [size], int b [size], int q [size], int values)
{
int i;

for (i = 0; i < 3; i++)
q[i] = a[i] / b[i];
}

void print (int a [size], int b [size], int answer [size], char op, int values)
{
char gosh;
int i;
for (i = 0; i < 3; i++)
{
cout<<"1. "<<a[i]<<gosh<<b[i]<<"="<<answer[i]<<endl;
cout<<"2. "<<a[i]<<gosh<<b[i]<<"="<<answer[i]<<endl;
cout<<"3. "<<a[i]<<gosh<<b[i]<<"="<<answer[i]<<endl;
}
}

int sum_of_all (int data1 [size], int data2 [size], int values)
{

}
The values parameter seems to correspond to the user input you get here

1
2
cout<<"Enter the number of data values: ";
cin>> howMany;


But it seems like the arrays have a fixed size of 3. Is that supposed to be hardcoded per the assignment or should the user be able to enter however many values they want?
So then int values means 3? I put three because that's how many elements there are in the array but I'm not sure if that's what it's supposed to mean especially with the input function.
Topic archived. No new replies allowed.