Can someone take a look at my code and see if they notice something wrong.

int score;
	 char grade =0;

     // read in total score 

     cout << endl;
     cout << "Enter total score (float, must be <= 100): "; 
     cin >> score;  
     
     if (score >= 85); 
        grade = 'A';
	 else if (score >= 75); 
        grade = 'B';
	 else if (score >= 65); 
        grade = 'C';
	 else if (score >= 55);
	    grade = 'D';
	 else 
	    grade = 'F';
	 End if // score >= 55
     End if // score >= 65
     End if // score >= 75
     End if // score >= 85



     // display the result 

	 cout << endl; 
     cout << "Your grade for CMSC 101 is: " << grade << endl; 
     return (0); // terminate with success

C and C++ do not have "END IF" statements.

int score;
    char grade =0;

     // read in total score 

    cout << endl;
    cout << "Enter total score (float, must be <= 100): "; 
    cin >> score;  
     
    if (score >= 85); 
       grade = 'A';
    else if (score >= 75); 
        grade = 'B';
    else if (score >= 65); 
        grade = 'C';
     else if (score >= 55);
        grade = 'D';
     else 
        grade = 'F';

     // display the result 

    cout << endl; 
    cout << "Your grade for CMSC 101 is: " << grade << endl; 
    return (0); // terminate with success

Take away all those semi-colons after the if and else-if statement:

if (score >= 85); 
        grade = 'A';
	 else if (score >= 75); 
        grade = 'B';
	 else if (score >= 65); 
        grade = 'C';
	 else if (score >= 55);
	    grade = 'D';
	 else 
	    grade = 'F';
commented: Good catch, I hadn't noticed that :) +36

Can someone take a look at my code and see if they notice something wrong.

int score;
	 char grade =0;

     // read in total score 

     cout << endl;
     cout << "Enter total score (float, must be <= 100): "; 
     cin >> score;  
     
     if (score >= 85); 
        grade = 'A';
	 else if (score >= 75); 
        grade = 'B';
	 else if (score >= 65); 
        grade = 'C';
	 else if (score >= 55);
	    grade = 'D';
	 else 
	    grade = 'F';
	 End if // score >= 55
     End if // score >= 65
     End if // score >= 75
     End if // score >= 85



     // display the result 

	 cout << endl; 
     cout << "Your grade for CMSC 101 is: " << grade << endl; 
     return (0); // terminate with success

Start using C++....when posting in the C++ section :D :D

int score;
char grade;

	     // read in total score

	     cout << endl;
	     cout << "Enter total score (float, must be <= 100): ";
	     cin >> score;

	     if (score >= 85)
	        grade = 'A';
		 else if (score >= 75)
	        grade = 'B';
		 else if (score >= 65)
	        grade = 'C';
		 else if (score >= 55)
		    grade = 'D';
		 else
		    grade = 'F';




	     // display the result

		 cout << endl;
	     cout << "Your grade for CMSC 101 is: " << grade << endl;
	     return (0); // terminate with success
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.