cant seem to figure out what the error is :(

``````#include<iostream>
using namespace std;

//prototyping variables
void averageCal(double a[]);
void productCal (double p[]);
void sumCal (double s[]);

int main ()
{

double userinputs [5];//storing the user inputs in a array

for(int i=0; i<5; i++)//suing a for loop to cycly and store the user inputs
{
cin>>userinputs[i];
}//end of for loop for user inputs

//displaying the average,product and sum on screen
cout << "The average of the 5 numbers are: " << averageCal(userinputs[]) << endl;
cout << "The product of the 5 numbers are: " << productCal(userinputs[]) << endl;
cout << "The sum of the 5 numbers are: " << sumCal(userinputs[]) << endl;

return 0;
}

//function for finding the average
void averageCal (double a[])
{
//initialize variables
double average_ans = 0;

for (int c = 0; c < 5; c++)//for loop to add the numbers

average_ans = addition / 5;//dividint the numbers by 5

cout << average_ans << endl;

}//end of function

//function for finding the product
void productCal (double p[])
{//initializing variables
double multiplication= 1;
double product_ans= 0;

for (int m = 0; m < 5; m++)//for loop to cycle through the user numbers and multiply them
{multiplication = multiplication * p[m];}//end of for

cout << multiplication << endl;
}

//function fo rfinding the sum
void sumCal (double s[])
{//variables

for (int a = 0; a < 5; a++)//for loop

}
``````

lines 26-28: you can't put functions that have no return value in cout statements. What do you expect cout to print? It can't print what the function doesn't return.

## All 4 Replies

lines 26-28: you can't put functions that have no return value in cout statements. What do you expect cout to print? It can't print what the function doesn't return.

sorry about that here is the code can you tell me whats wrong here

``````#include<iostream>
using namespace std;

//prototyping variables
void averageCal(double a[]);
void productCal (double p[]);
void sumCal (double s[]);

int main ()
{

double userinputs [5];//storing the user inputs in a array

for(int i=0; i<5; i++)//suing a for loop to cycly and store the user inputs
{
cin>>userinputs[i];
}//end of for loop for user inputs

//displaying the average,product and sum on screen
averageCal;
productCal;
sumCal;

return 0;
}

//function for finding the average
void averageCal (double a[])
{
//initialize variables
double average_ans = 0;

for (int c = 0; c < 5; c++)//for loop to add the numbers

average_ans = addition / 5;//dividint the numbers by 5

cout << "The average of the 5 numbers is: " <<average_ans << endl;

}//end of function

//function for finding the product
void productCal (double p[])
{//initializing variables
double multiplication= 1;
double product_ans= 0;

for (int m = 0; m < 5; m++)//for loop to cycle through the user numbers and multiply them
{multiplication = multiplication * p[m];}//end of for

cout << "The product of the 5 numbers is: " << multiplication << endl;
}

//function fo rfinding the sum
void sumCal (double s[])
{//variables

for (int a = 0; a < 5; a++)//for loop

cout << "The sum of the 5 numbers are: "<< addition<< endl;
}
``````
``````averageCal;
productCal;
sumCal;
``````

should be

``````averageCal(userinputs);
productCal(userinputs);
sumCal(userinputs);
``````

They are functions. You should call them accordingly.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.