编写一个程序,将大写字母A转换为小写字母a

2022-08-08 社会 163阅读

#include "string.h"
#include "std

io.h"main(){ char str[20],*p;printf("please input strings:\n");gets(str);

p=str;while(*p!='\0')
{if(*p>='a' && *P <='z')*p= *p - 3...

// 转化为小写
$str = "Mary Had A Little Lamb and She LOVED It So";
$str = strtolower($str);
echo $str; // 打印 mary had a little lamb and she loved it so

// 转化为大写
$str = "Mary Had A Little Lamb and She LOVED It So";
$str = strtoupper($str);
echo $str; // 打印 MARY HAD A LITTLE LAMB AND SHE LOVED IT SO

1、打开VC++环境,调节至使自己舒适的环境。调节字体和字的大小。

2、编辑程序: 

#include

void main()

{char a;printf("请输入一个小写字母: ");a=getchar(); a=a-32;printf("转换后的大写字母是:%c\n",a);}

3、进行编译,连接,运行,检验结果:

main()
{char x; scanf("%c",&x); if(x>='a' && x<='z') x-=32; printf("%c\n",x);}

声明:你问我答网所有作品(图文、音视频)均由用户自行上传分享,仅供网友学习交流。若您的权利被侵害,请联系fangmu6661024@163.com