给定一个字符串,将其中所有的小写字母转换成大写字母。
helloworld123Ha
HELLOWORLD123HA
1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 using namespace std; 5 char a[100001]; 6 char ans[1001]; 7 int now; 8 int main() 9 { 10 gets(a); 11 int l=strlen(a); 12 for(int i=0;i<l;i++) 13 { 14 if(a[i]>=97&&a[i]<=122)a[i]=a[i]-32; 15 }//大小写转换 16 17 puts(a); 18 return 0; 19 }
原文:http://www.cnblogs.com/zwfymqz/p/6479639.html