You cannot have an else if
by itself.
In this part of the code you have;
void e_syllabus() {
string english1, math1;
else if (english1 == "english")
{
cout << "\tHere are the important information for the english syllabus:\n"<<endl;
cout << "\tInstructor name: \n" <<"\tHeather "<<endl;
cout << "\tOffice Number & Hours: \n" <<"\tTuesday and Thursday from 11:00am-1:30pm and by appointment @ Flowers Hall: 210"<<endl;
cout << "\tContact: \n" <<"\tPhone: x53783"<< "\tEmail: hr@txstate.edu"<<endl;
cout << "\tTextbook: \n" <<"\tReading the World: Ideas that Matter & The Bedford Handbook";
}
Zooming you have;
else if (english1 == "english")
The correct way to implement it would be something like:
if(A == B){
//do something
}
else if (C == D){
//do something here
}
In your case would be;
if(A == B){
//do something
}
else if (english1 == "english")
{
cout << "\tHere are the important information for the english syllabus:\n"<<endl;
cout << "\tInstructor name: \n" <<"\tHeather "<<endl;
cout << "\tOffice Number & Hours: \n" <<"\tTuesday and Thursday from 11:00am-1:30pm and by appointment @ Flowers Hall: 210"<<endl;
cout << "\tContact: \n" <<"\tPhone: x53783"<< "\tEmail: hr@txstate.edu"<<endl;
cout << "\tTextbook: \n" <<"\tReading the World: Ideas that Matter & The Bedford Handbook";
}
manpreet
Best Answer
2 years ago
I'm new to C++ programming, just can't figure out why it is giving me an "else without a previous if" error.