C语言学习:任意大小写字母转换,c语言作业,键盘输入1个大写字母,将其转化为小写字母后换行输出;键盘再输入1个小写字母,将其转化为?

c语言作业,键盘输入1个大写字母,将其转化为小写字母后换行输出;键盘再输入1个小写字母 , 将其转化为#include <stdio.h>
#include <conio.h>
void main()
{
char c;
printf("请输入一个大写字母:");
scanf("%c",&c);
c+=32;
printf("\n对应小写字母:%c",c);
printf("\n请输入一个小写字母:");
scanf(" %c",&c);
c-=32;
printf("\n对应大写字母:%c",c);
getch();
}
C语言,任意输入十个字符,统计其中数字,字母,空格及回车,其他字符的个数参考下面的代码:
【C语言学习:任意大小写字母转换,c语言作业,键盘输入1个大写字母,将其转化为小写字母后换行输出;键盘再输入1个小写字母,将其转化为?】#include<stdio.h>
int main()
{
char c;
int num=0,lett=0,bar=0,others=0;
scanf("%c",&c);
while(c!='#')
{
if(c==' ') bar++;
else if(c>='0'&&c<='9') num++;
else if(c>='a'&&c<='z' || c>='A'&&c<='Z') lett++;
else others++;
scanf("%c",&c);
}
return 0;
}
C语言中怎么把数字字符转换成对应的数值ch-'0'是计算每个数字字符在数字中所对应的位置,较难理解的是10*d  , 因为输入的是多个数,每次计算完一个数字字符,依然处在循环中带入下一次的计算,因此10*d的作用就是把上一次算得的结果往高位送,每乘以一个十就高一位 。说得不大清楚 , 不清楚的话还请见谅?。?
C语言中从键盘输入一个英文句子,输出所有首字母大写的单词源代码如下(vc++6.0下编译通过):#include <stdio.h>#include <string.h>#define MAX_SENTENCE_STR_LEN 1024int main(){char English_sentence[MAX_SENTENCE_STR_LEN] = {0};char word[32] = {0};char *token = NULL;char *seps = " ";printf("please input a English sentence: \n");gets(English_sentence);token = strtok(English_sentence, seps);while (token != NULL){strcpy(word, token);if (word[0] >= 'A' && word[0] <= 'Z'){printf("%s\n", word);}token = strtok(NULL, seps);}return 0;}希望对你有帮助 。
c语言设计程序判断输入的是大写或小写字母或其他字符用if else语句#include<stdio.h>main(){charch;printf("从键盘输入一个字符\n");ch=getchar();if(97<=ch&&ch<=122){printf("该字符为小写字母");putchar('\n');
}elseif(65<=ch&&ch<=90){printf("该字符为大写字母");putchar('\n');
}elseif(48<=ch&&ch<=57){printf("该字符为数字");putchar('\n');
}elseif(ch==32){printf("该字符为空格");;putchar('\n');
}else{printf("该字符为其它字符");putchar('\n');}}

    推荐阅读