c++

4396y 发表于 1年前 · 关联问题 判断字符类型

include "pch.h"

include

using namespace std;

int main() {

//1 char n; while (cin >> n) { if (n >= 'a'&&n <= 'z') { cout << "lower"; } else if (n >= 'A'&&n <= 'Z') { cout << "upper"; } else if (n == ' ') { cout << "space"; } else if (n >= '0'&&n <= '9') { cout << "digit"; } else { cout << "other"; } }

}