#include <iostream>
using namespace std;
int main()
{
char n;
cout << "输入a-z:" ;
cin >> n;
n = n - 32;
cout << n << endl;
return 0;
}
输入一个小写字母,输出其大写字母。
分析下面的程序,会输出什么?
#include <iostream>
using namespace std;
int main()
{
char n;
n = 65;
cout << n << endl;
return 0;
}
结果输出一个大写字母A
再一个程序
#include <iostream>
using namespace std;
int main()
{
char n;
int s;
n = 'a';
s = n - 32;
cout << n << endl;
cout << s << endl;
n = s;
cout << n << endl;
return 0;
}