输入n个字母,如果是小写字母将其转换为大写字母,输出转换后的字符串。
引入头文件#include <ctype.h>
,使用大写转换函数toupper()
。
#include <stdio.h>
#include <ctype.h>
int main(void) {
char ch;
while((ch = getchar())!= '\n'){
ch = toupper(ch);
printf("%c",ch);
}
}
输入输出测试:
aPPle
APPLE