Ok first problem
1) Your function
int grade (int y)
all this function does is multiplies whatever number you pass it by 10
return y*10
. It does not do anything to determine if the student has a passing grade.
A) First determine what the passing grade limit is. Then you are going to have to check the number the user entered against the passing grade number to see if its higher then or less then.
2) You never called you function in
int main()
.
A) To call a function you do something like this If I use your code as a example.
1 2 3 4 5 6 7 8 9 10
|
int main()
{
int student; // Declares a variable to hold the students grade
cin >> student; // User inputs thier grade into the variable
grade(student); // Calls your function
return 0;
}
|
3) You never asked the user for their grade! And you never created a variable to hold the grade!
A) Look up how input and output work (
cin
, and
cout
). http://www.cplusplus.com/doc/tutorial/basic_io/. And also if you don't know about variables by now I highly reccomend you pay attention more!!!!
4) I dont think you understand what a for loop does, and are using it incorrectly.
A) Check out here for more info on control structers. http://www.cplusplus.com/doc/tutorial/control/
4) The teacher said to print a message that tells the user if they have passed or not. The only
cout
you have is this
1 2
|
for (intx=1;x<=60;x++)
cout<<"indicating"<<endl;
|
and all that does is print "indicating" 60 times on the console. And not to mention you have no spaces between anything so it will error out.
A) Again check out how input and output work.
5) Your function is after main so even if you did call it in main it wouldn't work.
A) Put a function prototype above main, something like this
1 2 3
|
int grade(int y);
int main()
|
. If you need more info about function check here http://www.cplusplus.com/doc/tutorial/functions/
I think that covers most of it so their is your HELP! Also next time when people try to help you please act civilly. Also if they are teaching functions in your class already and this is what you can write only I would highly recommend you start over from the beginning.