// grade.cpp
// display the letter grade corresponding to an exam
// score assuming a noormal scale

# include <iostream>;
using namespace std;

void displayGrade (int score);

 int main ()
{
     int score;
     displayGrade();
     cin.get();
     return 0 ;
     }
// get the data
void displayGrade
cout << " ENTER THE GRADE : " << score << endl;
cin >> score;
{
    if ( score >= 90 ) cout << "grade is A" << endl;
    else if ( score >=80 ) cout << "grade is B " << endl;
    else if ( score >= 70 ) cout << " grade is C " << endl;
    else if ( score >= 60 ) cout << " grade is D " << endl;
    else cout << "grade is F " << endl;
}
return displayGrade;

I am still confused with the function and variable and the way we declare and organize it/.

// grade.cpp
// display the letter grade corresponding to an exam
// score assuming a noormal scale

# include <iostream>;
using namespace std;

void displayGrade (int score);

int main ()
{
int score;
displayGrade();
cin.get();
return 0 ;
}
// get the data
void displayGrade
cout << " ENTER THE GRADE : " << score << endl;
cin >> score;
{
if ( score >= 90 ) cout << "grade is A" << endl;
else if ( score >=80 ) cout << "grade is B " << endl;
else if ( score >= 70 ) cout << " grade is C " << endl;
else if ( score >= 60 ) cout << " grade is D " << endl;
else cout << "grade is F " << endl;
}
return displayGrade;


I am still confused with the function and variable and the way we declare and organize it/.

Hi ,
Your question is not clear to me.. what exactly you want to know.
The code written above will give compilation error as it will not identify any function displayGrade() as the function you have declared before main is displayGrade(int).
Hence before calling any function make sure that the function is atleast declared.
There are also a few syntax errors. But please be specific what exactly you want.

Hi

here is your way to a good grade.... :D

// grade.cpp
// display the letter grade corresponding to an exam
// score assuming a noormal scale

# include <iostream>;

void displayGrade (int);

 int main ()
{
    int score;
	std::cout << " Enter your score to get a grade : " << std::endl;
	std::cin >> score;
	displayGrade(score);
	return 0 ;
}
// get the data
void displayGrade(int someScore)
{
	if ( someScore >= 90 ) 
		std::cout << "For this score you get grade A" << std::endl;
    else if ( someScore >=80 ) 
		std::cout << "For this score you get grade B " << std::endl;
    else if ( someScore >= 70 ) 
		std::cout << "For this score you get grade C " << std::endl;
    else if ( someScore >= 60 ) 
		std::cout << "For this score you get grade D " << std::endl;
    else 
		std::cout << "For this score you get grade F " << std::endl;
}

However u aint going to learn , unless u compare it with what u posted before and see your mistakes :cool:

This article has been dead for over six months. Start a new discussion instead.