Dotcpp  >  编程教程  >  ctype.h头文件  >  C语言toupper()函数:把小写字母转换为大写字母

C语言toupper()函数:把小写字母转换为大写字母

点击打开在线编译器,边学边练

函数名: toupper

头文件:<ctype.h>

函数原型:  int touppper(int ch);

功 能: 把小写字母转换为大写字母,不是小写字母的不变

参数: int ch  待转换的字符

返回值:  返回转换后的字符


程序例: 把小写字母转换为大写字母

#include<ctype.h>

#include<stdio.h>

int main(){

char ch1,ch2;

printf("input a character:");

scanf("%c",&ch1);

ch2=toupper(ch1);

printf("transform %c to %c.\n",ch1,ch2);

return 0;

}

 

运行结果:

input a character:g
transform g to G.



本文固定URL:https://www.dotcpp.com/course/447

C语言函数库
assert.h头文件
ctype.h头文件
float.h头文件
io.h头文件
math.h头文件
mem.h头文件
setjmp.h头文件
stdio.h头文件
stdlib.h头文件
sigal.h头文件
string.h头文件
time.h头文件
Dotcpp在线编译      (登录可减少运行等待时间)