CHAPTER6-7.cpp
上传用户:fjc899
上传日期:2007-07-03
资源大小:187k
文件大小:1k
- //文件名:CHAPTER6-7.cpp
- #pragma warning(disable:4786)
- #include <iostream>
- #include <string>
- #include <vector>
- using namespace std;
- #define OK 0
- #define INFO 1
- #define WARNING 2
- int main (void)
- {
- int return_code;
- vector<string> InfoMessages;
- vector<string> WarningMessages;
- InfoMessages.push_back("Info: Program started");
- WarningMessages.push_back("Warning: No Customer records have been found");
- return_code = OK;
- if (!InfoMessages.empty())
- { InfoMessages.push_back("Informational Messages:");
- return_code = INFO;
- }
- if (!WarningMessages.empty())
- { WarningMessages.push_back("Warning Messages:");
- return_code = WARNING;
- }
- if (InfoMessages.empty() && WarningMessages.empty())
- { cout << "There were no messages " << endl; }
- switch(return_code)
- {case 0:
- cout<<" Neither Informataion nor warning message"<<endl;
- break;
- case 1:
- cout<<InfoMessages[0]<<endl<<InfoMessages[1]<<endl;
- break;
- case 2:
- cout<<WarningMessages[1]<<endl<<WarningMessages[0]<<endl;
- break;
- }
- return return_code;
- }