📄 prog5_09.cpp
字号:
// Program 5.9 Using the continue statement
#include <iostream>
#include <iomanip>
#include <cctype>
#include <limits>
using std::cout;
using std::endl;
using std::setw;
int main() {
// Output the column headings
cout << endl
<< setw(13) << "Character "
<< setw(13) << "Hexadecimal "
<< setw(13) << "Decimal "
<< endl;
cout << std::uppercase; // Uppercase hex digits
unsigned char ch = 0; // Character code
// Output characters and corresponding codes
do {
if(!std::isprint(ch)) // If it does not print
continue; // skip this iteration
cout << setw(7) << ch
<< std::hex // Hexadecimal mode
<< setw(13) << static_cast<int>(ch)
<< std::dec // Decimal mode
<< setw(13) << static_cast<int>(ch)
<< endl;
} while(ch++ < std::numeric_limits<unsigned char>::max());
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -