I have included the code I am working on. I am new to the C++ programing and I am not understanding how to use the if statements. If someone could please point me in the right direction as what I am doing wrong. I can't get my program to run. the program is suppose to output "pass" if student scores at least 50 in three test. "pass by compensation" if students scores at least 50 in two test, the lowest is at least 40. and fail if neither of the top two critierias are met. I would really appreciate your help
#include<iostream>
#include<string>
using namespace std;
const int AVERAGE_SCORE = 50;
const int NUMBER_OF_TEST = 3;
int main(void)
{
// 1. Input test scores
cout << "Enter three test scores in the range [0..100]," << endl;
cout << "seperated by spaces: ";
int score1,score2, score3;
cin >> score1 >> score2 >> score3;
cin.ignore(99,'\n');
bool wrongInput = cin.fail();
if ( wrongInput )
{
cin.clear();
cin.ignore(99,'\n');
cout << "Bad input, terminating. " << endl;
cout << "Press ENTER to finish...";
cin.ignore(99,'\n');
return 1;
}
// 2. Process
// 2.2 Calculating average scores.
int sum = score1 + score2 + score3;
int studentsGrade = sum/ NUMBER_OF_TEST;
I've been working on my program and it still doesnt work. This is what I have so far. I got ride of the lines 44-48 and it still shows an error message about the else.