finding average

Feb 14, 2010 at 4:52pm
can anyone tell me what am doing wrong i get 1 error average = find_average(input_numbers) only take 1 argument.And it have to find the highest and lowest number. after I remove average = find_average(input_numbers) I get more errors on highest and lowest is uninitialized local variable & find_average & average is unreferenced.

{ int count = 0;

do
{
count++;



while (input >> value)
{
sum += value;
count++;

}


return sum/count;
}

void output(const char name[], int highest, int lowest, ostream& os) // Print results

{ os << "\n\nInput File Name : " << name << endl;
os << "Largest Number is : " << setw(8) << highest << endl;
os << "Smallest Number is: " << setw(8) << lowest << endl;
os << "The Average is : " << setw(8) << find_average << endl; }[/code]
Last edited on Feb 15, 2010 at 4:40pm
Feb 14, 2010 at 5:56pm
you are missing a return bracket, as best as I can tell, there is something hinky with the return bracket on your initial/outermost do/while loop. Line 60 of my test editor shows the following bracket as the return to the to this do/while loop.

} // End of open_input()
Last edited on Feb 14, 2010 at 6:00pm
Feb 14, 2010 at 6:07pm
i know i had to change the last bracket from { to } now it saying
average = find_average(input_numbers); having problems
Feb 14, 2010 at 6:14pm
can you copy and paste your latest revision in code tag (the <> symbol to the right that appears when you are inputting a response) so I can see the error myself and the line on which it occurs?, thanks
Feb 14, 2010 at 6:23pm
okay
Feb 14, 2010 at 6:36pm
line 21: find_average. your functions and variables mustn't have the same name.
line 34: you need } while(some_condition); and }//end of main() here.
Feb 15, 2010 at 6:58am
still not working like it should any know how to rewrite the output to read and print average that the problem am having
Topic archived. No new replies allowed.