编写一个大写变小写,小写变大写#include<stdio.h>#include<string.h>main(){char a[100],b[100];int i;scanf("%s",a);for(i=0;i<100;i++){ if(a[i]>='a'&&a[i]<='z')b[i]=a[i]-32;else if(a[i]&g
来源:学生作业帮助网 编辑:作业帮 时间:2024/08/25 06:20:38
![编写一个大写变小写,小写变大写#include<stdio.h>#include<string.h>main(){char a[100],b[100];int i;scanf("%s",a);for(i=0;i<100;i++){ if(a[i]>='a'&&a[i]<='z')b[i]=a[i]-32;else if(a[i]&g](/uploads/image/z/8727911-71-1.jpg?t=%E7%BC%96%E5%86%99%E4%B8%80%E4%B8%AA%E5%A4%A7%E5%86%99%E5%8F%98%E5%B0%8F%E5%86%99%2C%E5%B0%8F%E5%86%99%E5%8F%98%E5%A4%A7%E5%86%99%23include%26lt%3Bstdio.h%26gt%3B%23include%26lt%3Bstring.h%26gt%3Bmain%28%29%7Bchar+a%5B100%5D%2Cb%5B100%5D%3Bint+i%3Bscanf%28%26quot%3B%25s%26quot%3B%2Ca%29%3Bfor%28i%3D0%3Bi%26lt%3B100%3Bi%2B%2B%29%7B+if%28a%5Bi%5D%26gt%3B%3D%26%2339%3Ba%26%2339%3B%26amp%3B%26amp%3Ba%5Bi%5D%26lt%3B%3D%26%2339%3Bz%26%2339%3B%29b%5Bi%5D%3Da%5Bi%5D-32%3Belse+if%28a%5Bi%5D%26g)
编写一个大写变小写,小写变大写#include<stdio.h>#include<string.h>main(){char a[100],b[100];int i;scanf("%s",a);for(i=0;i<100;i++){ if(a[i]>='a'&&a[i]<='z')b[i]=a[i]-32;else if(a[i]&g
编写一个大写变小写,小写变大写
#include<stdio.h>
#include<string.h>
main()
{
char a[100],b[100];
int i;
scanf("%s",a);
for(i=0;i<100;i++)
{
if(a[i]>='a'&&a[i]<='z')
b[i]=a[i]-32;
else if(a[i]>='A'&&a[i]<='Z')
b[i]=a[i]+32;
else
b[i]=a[i];
}
for(i=0;i<100;i++)
printf("%c",b[i]);
}
为什么 会有后面哪些字?
编写一个大写变小写,小写变大写#include<stdio.h>#include<string.h>main(){char a[100],b[100];int i;scanf("%s",a);for(i=0;i<100;i++){ if(a[i]>='a'&&a[i]<='z')b[i]=a[i]-32;else if(a[i]&g
b[100]不是所有元素都初始化也就是不够100个,没有初始化后边的b[8]以后的字符都应该是未知数,是什么都有可能,不过程序调试会把没用的内存填成 CC 这是为了调试方便,这个编码正好是烫字,所以只要超出数据域都是烫字
.