求好心人指教
#include <iostream>
using namespace std;
char changeChar(char temp)
{
temp='temp'-'A'+'a';
cout<<"转化后的字母是:"<<temp<<endl;
return temp;
}
int main()
{
char temp;
cout<<"请输入一个小写字母:"<<endl;
cin>>temp;
cout<<"输出刚才输入的字母:"<<temp<<endl;
changeChar(temp);
return 0;
}为什么这个程序不能讲一个小写字母转换为大写字母
[解决办法]
小写字母转换为大写字母
不应该是
temp='temp'-'A'+'a';
而应该是
temp=temp-'a'+'A';