Speak now
Please Wait Image Converting Into Text...
Embark on a journey of knowledge! Take the quiz and earn valuable credits.
Challenge yourself and boost your learning! Start the quiz now to earn credits.
Unlock your potential! Begin the quiz, answer questions, and accumulate credits along the way.
Course Queries Syllabus Queries 2 years ago
Posted on 16 Aug 2022, this text provides information on Syllabus Queries related to Course Queries. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
Turn Your Knowledge into Earnings.
I'm new to C++ programming, just can't figure out why it is giving me an "else without a previous if" error.
class Math { public: void m_syllabus() { string math1; if (math1 == "math"){ cout << "\tHere are the important information for the math syllabus:\n"<<endl; cout << "\tInstructor name: \n" <<"\tDr. Zhong J"<<endl; cout << "\tOffice Hours: \n" <<"\tMonday and Wednesday from 10:30am-11:30am and by appointment"<<endl; cout << "\tContact: \n" <<"\tPhone: 245-9966"<< "\tEmail: zjj10@txstae.edu"<<endl; cout << "\tTextbook: \n" <<"\tPrecalculus, Sullivan, 10th edition"<< endl; cout << "\tGrading: \n" <<"\tTest 1, 2, 3 are 15% each"<< endl; cout << "\tAttendance:\n" <<"\t10% "<< endl; cout << "\tQuizzes:\n" <<"\t25%"<< endl; cout << "\tFinal Exam:\n" <<"\t20%"<< endl; cout << "\tTest 1: 9/21(Wed)"<<endl; } } }; // the English class class English { public: 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"; } } }; int main() { string math1, english1, computer_science1, philosophy1, us1100_1; math1 = "math"; english1 = "english"; computer_science1 = "computer_science"; philosophy1 = "philosophy"; us1100_1 = "us1100"; cout << "What syllabus do you need?\n"; cin >> math1, english1, computer_science1, philosophy1, us1100_1; Math retrieve_m; retrieve_m.m_syllabus(); English retrieve_e; retrieve_e.e_syllabus(); return 0; }
You cannot have an else if by itself.
else if
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"; }
No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.
Course Queries 4 Answers
Course Queries 5 Answers
Course Queries 1 Answers
Course Queries 3 Answers
Ready to take your education and career to the next level? Register today and join our growing community of learners and professionals.