00问答网
所有问题
随便输入一串字符将小写字母转化为大写字母。(不用到strupr函数)
用循环和数组的知识写,也不用到函数和指针
举报该问题
推荐答案 2008-05-19
将读到的每一个小写字母的值加上32,就得到了对应的大写字母,然后输出就行了
温馨提示:答案为网友推荐,仅供参考
当前网址:
http://00.wendadaohang.com/zd/jZnZjBrr.html
其他回答
第1个回答 2008-05-19
那就利用ASCII码 A-Z 与a-z的差是32
第2个回答 2008-05-19
#include <iostream.h>
#include <stdio.h >
void main()
{
char str[100],c;
int i=0;
while((c=getchar())!='\n')
{
str[i]=c>='a'&&c<='z'?c-32:c;
i++;
}
str[i]='\0';
cout<<str<<endl;
}
第3个回答 2008-05-19
#include <stdio.h>
#include <stdlib.h>
main()
{
char str[100];
char *tp = str;
scanf("%s",str);
while(*tp!='\0')
{
if(*tp>='a' && *tp<='z')
*tp += ('A'-'a');
tp++;
}
printf("after transfer : %s",str);
}
第4个回答 2021-05-11
您的浏览器不支持HTML5视频
1
2
下一页
相似回答
大家正在搜
相关问题
将字符串中的小写字母转化为大写字母。(不用到strupr函数...
从键盘输入一个字符串,将小写字母全部转换成大写字母。(不使用...
编写一个函数,将输入的一串字符中的小写字母转变成大写字母,在...
C语言用strupr函数将字符串中小写字母转换成大写字母,其...
编程题 编程将任意输入的小写字母转化成大写字母并输出
怎样编程输入一串字符,将其中小写字母全部转换为大写
从键盘输入字符串,将字符串中所有的大写字母转换为小写字母,其...
编写程序实现函数strupr(字符串)的功能, 即将字符串中...