1.判断是否是大小写字母
#include <iostream> using namespace std; int main() { char c; cin >> c; if (c >= 'A' && c <= 'Z') { cout << "BIG" << endl; } else if (c >= 'a' && c <= 'z') { cout << "SMALL" << endl; } else { cout << "NO" << endl; } return 0; }2.大小写转换
#include <iostream> using namespace std; int main() { int n; cin >> n; char s[105]; cin >> s; for (int i = 0; i < n; i++) { if (s[i] >= 'a' && s[i] <= 'z') { s[i] = s[i] - 32; } } cout << s << endl; return 0; }3.打印小写字母表
#include <iostream> using namespace std; int main() { char ch = 'a'; for (int i = 0; i < 13; i++) { cout << ch; ch++; } cout << endl; for (int i = 0; i < 13; i++) { cout << ch; ch++; } cout << endl; ch = 'z'; for (int i = 0; i < 13; i++) { cout << ch; ch--; } cout << endl; ch = 'm'; for (int i = 0; i < 13; i++) { cout << ch; ch--; } cout << endl; return 0; }4.元音字母
#include <iostream> using namespace std; int main() { char c; cin >> c; if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') { cout << "Vowel" << endl; } else { cout << "Consonant" << endl; } return 0; }5.大写字母出现的个数
#include <iostream> using namespace std; int main() { int n; cin >> n; char s[105]; cin >> s; int cnt = 0; for (int i = 0; i < n; i++) { if (s[i] >= 'A' && s[i] <= 'Z') { cnt++; } } cout << cnt << endl; return 0; }