1. ## Letter grades are all E and F

Hi this program has a serious logical error I can't faddle out.
It all works fine when I enter a score of under 50, but anything
over this it prints E and ignores the other if statements.
I even made sure the range is correct before the value is passes to
the function.

Code:
```#include <iostream>

// function prototype

// main function ///////////////////////////////////////////////////////////////
//
int main ( void )
{
int score;

std::cout << "Enter exam score ( 1 - 100 ): ";
std::cin >> score;

// validate input is within correct range
if (( score < 1 ) || ( score > 100 ))
{
std::cout << "\nERROR: Invalid input, terminating..." << std::endl;
}

else
{
std::cout << "\nGrade attained: " << calculateGrade ( score ) << "\n";
}

std::cin.get(); // freeze console window output
std::cin.ignore();

return 0; // indicate program terminated sucessfully
}

// function to calculate and return letter grade dependant
// on value of score number passed
char calculateGrade ( int x )
{
char grade = '/0'; // nulled for some kind of assignment

if (( x == 100 ) || ( x >= 90 ))

if (( x == 89 ) || ( x >= 80 ))

if (( x == 79 ) || ( x >= 70 ))

if (( x == 69 ) || ( x >= 60 ))

if (( x == 59 ) || ( x >= 50 ))

if ( x < 50 )

}```

2. You really should use AND instead of OR. Ex.
Code:
```if(x <=100 && x >= 90)
I think the use of OR might be causing conflicts with other if statements.

3. First, you should be using else/ifs, so you don't have to execute every test each time. Second, each test should be using "&&", not "||". Third, you can simplify the logic, with something like:
Code:
```  if (x < 50) grade = 'F';
else if (x <= 59) grade = 'E';
else if (x <= 69) grade = 'D';
// etc.```

4. That worked thanks Sentral. The reason I used OR is because I need either expression to be TRUE for the assignmnet. Although seeing it, AND works the same as the >= operator ensures both conditions are TRUE. Doh! Silly mistake, although an easy one to make. Thanks again for the help.

EDIT ok, il change my logic, I just wanted to get it working ok before I made any changes to decrease the program size and maximise the logic