Hello everyone...
I have a problem on the last part of my codes.
This programm supposed to accept several kind of courses and its corresponding grades.
So far so good... but when it comes to display the courses and the grades and its remarks of passed or failed, the programm gives me an error message. Actually it gives me 45 errors beginning with the first if else statement.
Here are my codes so far:
#include <iostream>
#include <string>
using namespace std;
main()
{
string name, course[10], grade[10];
int x, y, n;
char response;
cout<< "Please enter your name: ";
cin>> name;
cout<< "Please enter number of subjects: ";
cin>> y;
cout<< "Hello " << name << " you have " << y << " subjects." << endl;
n=1;
for(int a=1; a<=y; a++)
{
cout<< "Please enter your course " << n << ":";
cin>> course[x];
cout<< endl;
cout<< "Please enter your Grade: ";
cin>> grade[x];
cout<< endl;
n++;
}
cout<< "Course Grade Remarks " << endl;
for(int ctr=1;ctr<=y;ctr++)
{
if (grade[ctr] < 75) // HERE THE FIRST ERROR STARTS
cout<< course[x]<< "5.0\t FAILED";
else if (grade[ctr] ==75)
cout<< course[x]<< "\t3.0\t passed";
else if (grade[ctr] <=78)
cout<< course[x]<< "\t2.75\t passed";
else if (grade[ctr] =81)
cout<< course[x]<< "\t2.5\t passed";
else if (grade[ctr] <=84)
cout<< course[x]<< "\t2.25\t passed";
else if (grade[ctr] <=87)
cout<< course[x]<< "\t2.0\t passed";
else if (grade[ctr] <=90)
cout<< course[x]<< "\t1.75\t passed";
else if (grade[ctr] <=93)
cout<< course[x]<< "\t1.5\t passed";
else if (grade[ctr] <=96)
cout<< course[x]<< "\t1.25 \t passed";
else if (grade[ctr] ==100)
cout<< course[x]<< "\t1.0\t passed";
else
cout<<"invalid input of grade";
}
cin>> response;
return 0;
}
If i set the if else statements in a comment block the programm runs ecxept the aoutput of course grade and remarks (pass/Failed).
Would be grate if somebody can help me out.