#include %26lt;iostream%26gt;
 using namespace std ;
 int main() 
{
 int grades ;  
     // read in total score 
     cout %26lt;%26lt; endl ;
     cout %26lt;%26lt; "Enter total score (float, must be %26lt;= 100) : " ; 
     cin %26gt;%26gt; score ;  
{    
  if (score%26gt;= 85){
 {
     Set grade = "A";  
 }
  else }
  if (score %26gt;= 75){
 {
      Set grade = "B";
 }
  else }
  if (score %26gt;= 65){
 {
  Set grade = "C";
 }
    else }
  if (score %26gt;= 55){
    {
         Set grade = "D";
   }
    else }
}
             Set grade = "F";
          End if // score %26gt;= 55
       End if // score %26gt;= 65
    End if // score %26gt;= 75
 End if // score %26gt;= 85 
     // display the result 
     cout %26lt;%26lt; endl ; 
     cout %26lt;%26lt; "Your grade for CMIS 1121 is: " %26lt;%26lt; grade %26lt;%26lt; endl ; 
     return (0); // terminate with success 
}
C++ errors: score and set undeclared identifier/ missing ; before identifiers and illegal else w/o matching if
you don't need to put Set before you do assignment like
Set grade = "A", just put grade = "A"
and throw an 
int score;
and take out int grades,
and make it char grade
and u should be sweet
Reply:the code after correct the errors :
//////////////////////////////////////...
#include %26lt;iostream%26gt;
using namespace std ;
int main() 
{
char grade ; 
int score;
// read in total score 
cout %26lt;%26lt; endl ;
cout %26lt;%26lt; "Enter total score (float, must be %26lt;= 100) : " ; 
cin %26gt;%26gt; score ; 
if (score%26gt;= 85)
grade = 'A'; 
else if (score %26gt;= 75)
 grade = 'B';
else if (score %26gt;= 65)
grade = 'C';
 
else if (score %26gt;= 55)
grade = 'D';
else 
grade = 'F';
// display the result 
cout %26lt;%26lt; endl ; 
cout %26lt;%26lt; "Your grade for CMIS 1121 is: " %26lt;%26lt; grade %26lt;%26lt; endl ; 
return (0); // terminate with success 
}
//////////////////////////////////////...
Subscribe to:
Post Comments (Atom)
 
No comments:
Post a Comment