#include <iostream>

using namespace std;


// This program takes the numerical score and outputs a letter grade.//

int getScore ()
{


    int count; 
    int score,



        for (count = 0; count <10; count ++){
    cout << "\nEnter the student's score: "<< endl;
    cin >> score



    }


    cout <<"\nThe score is/are: " << score << endl;
    return 0 ;
}



int printGrade()

{


    int grade =0;   


    if ( grade >= 90)
        cout <<"\nYour grade is A." << endl;
    else
    if (grade >= 80 )
        cout <<"\nYour grade is B." << endl;
    else
    if (grade >= 70 )
        cout <<"\nYour grade is C." << endl;
    else
    if (grade >= 60 )
        cout <<"\nYour grade is D." << endl;
    else
        cout <<"\nYour grade is F." << endl;    




return 0;

}

int main ()
{

    getScore();
    printGrade();
    int num = getScore ();

    cout << printGrade(num);



 return 0;
}

what errors are you getting? I see a couple of missing semicolons -- your compiler should complain about them. Look at the errors, then look at your code and see if you can figure out what's wrong.

This is the error i'm getting


Compiling...
printGrade.cpp
C:\Documents and Settings\Administrator\My Documents\printGrade.cpp(68) : error C2660: 'printGrade' : function does not take 1 parameters
Error executing cl.exe.

printGrade.obj - 1 error(s), 0 warning(s)

That error means the program is attempting to pass the wrong number of parameters. how many parameters to you see in that function? It doesn't have any parameters, yet your program is attempting to pass one parameter -- they have to be consistent.

i dont understand

i dont understand

Read your own program. That function has no parameters.

You better read about local variables, glodabl variables, and passing arguments to functions.

Here is a corrected version.

#include <iostream>
using namespace std;
// This program takes the numerical score and outputs a letter grade.//
int getScore ()
{
[INDENT]int count;
int score,

cout << "\nEnter the student's score: "<< endl;
cin >> score
cout <<"\nThe score is/are: " << score << endl;
return score;[/INDENT]
}



int printGrade( int grade)
{
[INDENT]if ( grade >= 90)
[INDENT]cout <<"\nYour grade is A." << endl;[/INDENT]
else if (grade >= 80 )[INDENT]cout <<"\nYour grade is B." << endl;[/INDENT]else if (grade >= 70 )[INDENT]cout <<"\nYour grade is C." << endl;[/INDENT]else if (grade >= 60 )[INDENT]cout <<"\nYour grade is D." << endl;[/INDENT]else[INDENT]cout <<"\nYour grade is F." << endl;[/INDENT]return 0;[/INDENT]}

int main ()
{
[INDENT]for ( int i = 0 ; i < 10 ; i++ )
{
[INDENT]int num = getScore ();
printGrade(num);[/INDENT]
}
return 0;[/INDENT]
}

i dont understand

Do you know what 'pass a parameter' means?

//If you have this function...
int printGrade(int grade) {
  if ( grade >= 90) {
     ...
  }
}

// 'grade' is a parameter that is passed into the function.

int main () {
  ...
  printGrade(23);
  ...
}

// Here the value 23 is passed into the function 'printGrade'
// using the variable 'grade'
Be a part of the DaniWeb community

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