📄 a265char.cpp
字号:
// nuovi concetti: espressione come argomento
// nuovi elementi: void, isdigit(), islower(), ecc...
#include <iostream>
using namespace std;
void printCharCategory(char c, int noprint) {
cout << "Il carattere [";
if (noprint)
cout << "---";
else
cout << c;
cout << "] e' un carattere ";
if (isdigit(c)) cout << "numerico.\n";
else if (islower(c)) cout << "lettera minuscola.\n";
else if (isupper(c)) cout << "lettera maiuscola.\n";
else if (isspace(c)) cout << "di spaziatura.\n";
else if (iscntrl(c)) cout << "di controllo.\n";
else if (ispunct(c)) cout << "d'interpunzione.\n";
else cout << "Errore.\n";
return;
}
int main() {
for (int c = 0; c < 128; c++) {
cout << c << ": ";
printCharCategory(c,c==8||c==10||c==13||c==26);
if (c%20 == 19)
getchar(); // funziona anche con tasti speciali!
}
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -