#include <iostream> #include <stdio.h> using namespace std; int main() { char x; cout << "请输入一个字母:" << endl; cin >> x; if (x >= 'a' && x <= 'z') { x = x - 'a' + 'A'; } else if (x >= 'A' && x <= 'Z') { x = x - 'A' + 'a'; } cout << "转换后的字符为:" << x << endl; system("pause"); return 0; }