c字符串大写字母转小写

Python016

c字符串大写字母转小写,第1张

#include<stdio.h>

int main()

{ int i

char s[200]

gets(s)

for(i=0s[i]i++)

  if(s[i]>='A'&&s[i]<='Z')s[i]+=32

printf("%s\n",s)

return 0

}

#include"stdio.h"

void

main()

{

char

a

int

c='a'-'A'

printf("大小写转换\n输入要转换的字符串:\n")

while(scanf("%c",&a)!=EOF)

{

if(a>='a'&&a<='z')//检测如果是小写则执行下一句,如果是大写则执行else

{

a=a-c

printf("%c",a)

}

else//如果检测是大写则执行这里

{

a=a+c

printf("%c",a)

}

}

}