#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;
}
sosy2001 0 Newbie Poster
Recommended Answers
Jump to Postwhat 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.
Jump to PostYou 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 …
All 7 Replies
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
sosy2001 0 Newbie Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
sosy2001 0 Newbie Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
WolfPack 491 Posting Virtuoso Team Colleague
Nedals 0 Light Poster
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.