# C++?



## Lyuba (Feb 11, 2010)

Ok I'm not asking anyone to do this for me but Im getting randome errors on this program, can anyone tell me what I'm doing wrong?
I think the program explains it self, it should take in the precent and give out the grade...


#include <fstream>
#include <iostream>

using namespace std;

int main()
{
int grade_num;

cout<< "Please enter numeric grade:"<< endl;
cin>> grade_num;
return 0;
}

char get_letter_grade (int grade_num)

{
if (grade_num<=60);
cout<< "The letter grade is F"<< endl;
else if ( grade_num<=69);
cout<< "The letter grade is D"<< endl;
else if (grade_num<=79);
cout<< "The letter grade is C"<< endl;
else if (grade_num<=89);
cout<< "The letter grade is B"<< endl;
else (grade_num<=100);
cout<< "The letter grade is A"<< endl;
return (grade_num);
}
bool is_passing(char grade_letter)

{


----------



## Lyuba (Feb 11, 2010)

Can someone pleas help me?


grade.cpp: In function âchar get_letter_grade(int)â:
grade.cpp:20: error: âelseâ without a previous âifâ
grade.cpp:22: error: âelseâ without a previous âifâ
grade.cpp:24: error: âelseâ without a previous âifâ
grade.cpp:26: error: âelseâ without a previous âifâ
grade.cpp: In function âbool is_passing(char)â:
grade.cpp:32: error: expected `}' at end of input


----------



## ThunderEvermore (Mar 31, 2010)

Sorry, read the rules after I posted help, not sure I should be responding...


----------



## koala (Mar 27, 2005)

Hi ThunderEvermore, it's ok to post a reply if you think you can help. This is an open forum where all members can post anywhere (except the Viruses forum where we have a team of trained specialists).


----------



## ThunderEvermore (Mar 31, 2010)

Ok great! I just didn't want to overstep any bounds...

Well in regards to the program I can see three main issues.

First off you are not calling any of your functions in your main class. This means that essentially your program does nothing.

Secondly your if statements are structured wrong. Here is how an if statement looks:

if (condition)
{
statement
}

If your statement is one line (as yours are) you can forgo the {}. Essentially if you remove the semicolons at the end of your if lines you'll fix it.

Last is your if_passing() function, which is incomplete. The program won't compile if at the very least you close the last curly brace.


----------

