#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
cin >> noskipws;
char ch;
while (cin >> ch)
{
if (isprint(ch))
cout << ' ' << ch;
else
cout << '^' << static_cast<char>('@' + ch);
cout << setw(4) << static_cast<int>(ch) << endl;
}
return 0;
}
ASCII Caret Notation
https://en.wikipedia.org/wiki/ASCII#Control_code_chart
单引号表示字符类型,只能有1个字符,多个字符就要用双引号,也就是字符串。
cout <<letter-0;