大家好,今天小编关注到一个比较有意思的话题,就是关于c语言键盘输出的问题,于是小编就整理了3个相关介绍c语言键盘输出的解答,让我们一起看看吧。
C语言编程:从键盘输入一个正方形的边长,求出它的面积并输出?
include<stdio.h>voidmain(){inta;printf("输入边长:");scanf(%d,&a);printf("面积是%d",a*a);}
C语言中从键盘输入一个英文句子,输出所有首字母大写的单词?
源代码如下(vc++6.0下编译通过):#include <stdio.h>#include <string.h>#define MAX_SENTENCE_STR_LEN ***int 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语言中从键盘输入一个英文句子,输出所有首字母大写的单词?
源代码如下(vc++6.0下编译通过):#include <stdio.h>#include <string.h>#define MAX_SENTENCE_STR_LEN ***int 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语言键盘输出的问题就介绍到这了,希望介绍关于c语言键盘输出的3点解答对大家有用。