1.整型:int,short,long,long long,char,unsigned int unsigned short....2
.最值:
#include#include int main(void) { using namespace std; int n{1}; cout << "n = " << n << endl; int n_int = INT_MAX; short n_short = SHRT_MAX; cout << "int is " << sizeof n_int << " bytes." << endl; cout << "Maximum value: " <<"int: " << n_int << endl; cout << "short is " << sizeof(short) << endl; cout << "Maximum value: " << "short: " << n_short << endl; return 0; }
3.越界:
#include#include using namespace std; int main(void) { short sam = SHRT_MAX; unsigned sue = sam; cout << "sam has " << sam << " dollars and sue has " << sue << " dollars" << endl; sam =sam +1; sue =sue +1; cout << "sam has " << sam << " dollars and sue has " << sue << " dollars" << endl; return 0; }
4.字符以及转义序列的应用:
#includeusing namespace std; int main(void) { char ch ='M'; int i = ch; cout << "Char " << ch << " equals " << i << " in int." << endl; cout << "Add one to " << ch << endl; ch = ch + 1; i = ch; cout << "Char " << ch << " equals " << i << " in int." << endl; cout << "Display char ch: "; cout.put(ch); cout.put('!'); cout << endl << "Donen"; return 0; }



