自学内容网 自学内容网

写一个代码,将字符串中的小写字母转大写,其它字符不变

#include<stdio.h>
#include<string.h>
#include<ctype.h>
int main()
{
char a[] = "I am a Student.";
int sz = strlen(a);
int i = 0;
for (i = 0; i < sz; i++)
{
if ((islower(a[i])) != 0)
{
a[i] = a[i] - 32;
}
}
printf("%s\n", a);
return 0;
}

输出结果:


原文地址:https://blog.csdn.net/2301_78189441/article/details/143046794

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!