#include "stdio.h"
#include "conio.h"
#include "string.h"
void main()
{
void upcase(char *cr, char *us);
char ss[20];
char uus[20];
printf("Please input a String:\n");
scanf("%s",ss);
upcase(ss,uus);
printf("转为大写为:%s",uus);
}
void upcase(char *cr, char *us)
{
for(; *cr!='\0'; cr++, us++ )
{
if(*cr>='a' && *cr<='z')
{
*us = *cr - 32;
}else
{
*us = *cr;
}
}
*us = '\0';
}
这个方法有待于改进,如果输入的字符中有空格的话,就只会输出前一部分。