【发布时间】:2012-09-15 10:41:14
【问题描述】:
如何使用toupper 函数转换字符串?这不起作用。
#include<stdio.h>
#include<string.h>
#include<ctype.h>
int main(){
char ch[20];
printf("\nEnter Your String :");
gets(ch);
int i=0;
for(i=0;ch[i] !='\0';i++)
{
putchar(toupper(ch[i]));
putchar(ch[i]);
}
return 0;
}
这个程序输出大写和小写我只想大写输出。我无法捕捉到我的逻辑错误。请帮我弄清楚逻辑概念
【问题讨论】:
-
怎么不行?你期望什么输出,你会得到什么?
-
什么不起作用?你得到什么输入和输出?
-
你的程序works as coded :)。