Help Needed Please :(
Oct 5, 2013 at 12:31am UTC
So I'm new to the site, and I'm in need of some assistance. I'm working on a program that will assign a letter grade to a numeric grade that is inputted by the user. I had a simple code that ran fine, but I was wanting to get some extra credit by adding some "bells & whistles". So I added a welcome and goodbye message, and now I'm adding a way to repeat the process instead of restarting the program, which is where I'm running into my problem.
I'm getting this error message: "(76): fatal error C1075: end of file found before the left brace '{' "
Any advice would be greatly appreciated.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
#include <iostream>
#include <string>
using namespace std;
int main()
{
double grade1; // This will hold the scores
char decision = '\0' ; // A variable for y or n input
string name; //Welcome message
cout << "Please enter your name:" ;
getline(cin, name);
cout << "Hello " << name << "!...Welcome to my automated grading program!" << endl << endl;
do
{
// Get the scores.
cout << "Please enter an numerical score (0 - 100): " ;
cin >> grade1;
// Dramatic pause.
cout << "Calculating..." << endl << endl;
// Constants for score thresholds
const int A_score = 90,
B_score = 80,
C_score = 70,
D_score = 60,
F_score = 50,
Z_score = 50;
// Determines letter grade.
if ((grade1 < 0) || (grade1 > 100))
grade1 = 'N' ;
else if (grade1 >= A_score)
cout << "Congratulations, you've made an: A! Outstanding!\n" ;
else if (grade1 >= B_score)
cout << "Congratulations, you've made a: B! Great!\n" ;
else if (grade1 >= C_score)
cout << "You have made a: C! Not bad \n" ;
else if (grade1 >= D_score)
cout << "You have made a: D! Don't give up! \n" ;
else if (grade1 >= F_score)
cout << "You have made an: F, Please try again! \n" << endl;
else if (grade1 <= Z_score)
cout << "You have made an: F, Please try again! \n" << endl << endl;
if (grade1 == 'N' )
cout << "N stands for invalid. "
<< "You must use a number between 0 and 100." << endl;
cout << "Would you like to continue? ( y=yes, n=no): " ;
cin >> decision;
while ( (decision != 'n' ) && (decision != 'N' ) );
cout << "Thank You for using this program" << endl <<endl;
cout << "Good-bye!" << endl;
system("pause" );
return 0;
}
Oct 5, 2013 at 1:19am UTC
while ( (decision != 'n' ) && (decision != 'N' ) );
should be }while ( (decision != 'n' ) && (decision != 'N' ) );
Topic archived. No new replies allowed.