CHAPTER2-21.cpp
上传用户:fjc899
上传日期:2007-07-03
资源大小:187k
文件大小:1k
- //文件名:CHAPTER2-21.cpp
- #pragma warning(disable:4786)
- #include <string>
- #include <iostream>
- using namespace std ;
- void trueFalse(int x)
- {
- cout << (x? "True": "False") << endl;
- }
- void main()
- {
- string S1="DEF";
- char CP1[]="ABC";
- char CP2[]="DEF";
- char CP3[]="DEFG";
- char CP4[]="def";
- cout << "S1 is " << S1 << endl;
- cout << "CP1 is " << CP1 << endl;
- cout << "CP2 is " << CP2 << endl;
- cout << "CP3 is " << CP3 << endl;
- cout << "CP4 is " << CP4 << endl;
- cout << "S1<=CP1 returned ";
- trueFalse(S1<=CP1); // False (调用语法1)
- cout << "S1<=CP2 returned ";
- trueFalse(S1<=CP2); // True (调用语法1)
- cout << "S1<=CP3 returned ";
- trueFalse(S1<=CP3); // True (调用语法1)
- cout << "CP1<=S1 returned ";
- trueFalse(CP1<=S1); // True (调用语法2)
- cout << "CP2<=S1 returned ";
- trueFalse(CP2<=S1); // True (调用语法2)
- cout << "CP4<=S1 returned ";
- trueFalse(CP4<=S1); // False (调用语法2)
- }