I had an assignment where i had to write 5 functions and then run them all in a main function.
I can succesfully compile the first two and they work but there is something wrong with each of these last three and i really can't figure it out. any help would be awesome. thanks!
Ok, a quick glance revealed the following :
1) There's a typo in the 6th line of your 1st function average(you wrote istream instead of ifstream).
2) You didn't declare count before using it.
I can succesfully compile the first two and they work but there is something wrong with ...
Your compiler is your friend. It will tell where and what it does not understand in your code. To understand compiler error messages is a useful skill to learn.
Compiler can be told to warn about legal but suspicious code too.
1 2 3 4 5 6 7 8 9 10 11 12
fin>>name>>score; // read once
while( !fin.eof() )
{
if (score>=50)
grade = 'P';
else
grade = 'F';
fout<<name<<grade;
// fin did not change in this body
// thus the end condition of this loop will never change
}