首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

求热心人指教

2013-06-25 
求好心人指教#include iostreamusing namespace stdchar changeChar(char temp){temptemp-A+ac

求好心人指教
#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';

热点排行