-
March 10th, 2009, 01:19 PM
#1
#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.
-
March 10th, 2009, 01:41 PM
#2
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.
-
March 10th, 2009, 02:39 PM
#3
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|