正在加载图片...
(13)从键盘输入一个字符串,分别输出其完全大写和完全小写的形式。 #indlude <string h> maino char str[20], low[20], up[20]; int i; printf("nPlease input a string: ) gets(str) printf( " \nThe letter list is: \n ) puts(str ) while(str[!=0) if(str[>=65&&str[门]<=90 low[=str[+32 up[]=st[]; else if(str[]>=97&&str[]<=122) low[=str[]: up[i]=str[]-32; ++; printf( "\nThe result is: n") puts(up; puts(low )} (13) 从键盘输入一个字符串,分别输出其完全大写和完全小写的形式。 #include <string.h> main() { char str[20],low[20],up[20]; int i; printf("\nPlease input a string:"); gets(str); printf("\nThe letter list is:\n"); puts(str); i=0; while(str[i]!='\0') { if(str[i]>=65&&str[i]<=90) { low[i]=str[i]+32; up[i]=str[i]; } else if(str[i]>=97&&str[i]<=122) { low[i]=str[i]; up[i]=str[i]-32; } i++; } printf("\nThe result is:\n"); puts(up); puts(low); }
<<向上翻页
©2008-现在 cucdc.com 高等教育资讯网 版权所有