-
#define and headers
When I use a #define for a header file, do I use it in the header file or in the associated .cpp file?
My switch statements:
Code:
case NAME:
cout << endl << "getline(cin, student.name);"
<< endl;
break;
case MIDTERM:
cout << endl << "student.midterm = GetIntInput()"
<< endl;
break;
case FINAL:
cout << endl << "student.final = GetIntInput()"
<< endl;
break;
case HOMEWORK:
cout << endl << "Add-Edit_Homework();"
<< endl;
break;
case TESTS:
cout << endl << "Add-Edit_Tests();"
<< endl;
break;
case QUIZZES:
cout << endl << "Add-Edit_Quizzes();"
<< endl;
break;
case PROJECTS:
cout << endl << "Add-Edit_Projects();"
<< endl;
break;
}
Are giving a ": not found before ;" error, and that is the only thing I can surmise to be wrong.
-
Re: #define and headers
If you have more than one .cpp file that uses the macros, put it in the .h
Although, if you are using it for a switch like this, it might be better to use an enum and group them together. It will save you some typing.
-
Re: #define and headers
Well, the fact that it isn't working worries me. But I'll check up on the syntax of an enum.