摘要: 1.实现一个菜单. #include <stdio.h> #include <string.h> void mainMenu(); void login(); void regist(); void shuiXianHua(); void returnToMenu(); main() { mainM 阅读全文
posted @ 2021-11-27 22:55 1只会飞猪 阅读(25) 评论(0) 推荐(0) 编辑
摘要: 用循环结构,求字符串长度 #include<stdio.h> main() { char str[80]; int cnt[10]={0}; int i=0; gets(str); while(str[i]!='\0') { if(str[i]>='0'&&str[i]<='9') cnt[(str 阅读全文
posted @ 2021-11-24 22:04 1只会飞猪 阅读(14) 评论(0) 推荐(0) 编辑
摘要: 定义一个含有8个存储单元的实型数组,从键盘上接收数,然后逆序输出。#include<stdio.h> main() { int m[8]; int i; for(i=0;i<=7;i++) scanf("%d",&m[i]); for(i=7;i>=0;i--) printf("%d",m[i]); 阅读全文
posted @ 2021-11-19 17:09 1只会飞猪 阅读(27) 评论(0) 推荐(0) 编辑
摘要: 1, 输出正三角 #include<stdio.h> main(){ int i,j; for(i=1;i<=6;i++){ for(j=1;j<=i;j++){ printf("*"); } printf("\n"); } 输出倒三角 #include<stdio.h> main(){ int i 阅读全文
posted @ 2021-11-09 10:29 1只会飞猪 阅读(20) 评论(0) 推荐(0) 编辑
摘要: 1编写程序,使用while语句求和sum=1+3+5+…+21 #include<stdio.h> main() { int i=1,sum=0; while(i<=21) { sum+=i; i+=2; } printf("%d\n",sum); } 2.编写程序,使用while语句求和sum=1 阅读全文
posted @ 2021-11-09 08:37 1只会飞猪 阅读(4) 评论(0) 推荐(0) 编辑
摘要: 1. 编写程序判断n是正数还是负数 #include<stdio.h> main() { int n; printf("输入一个整数:\n"); scanf("%d",&n); if(n<0) printf("%d是负数!\n",n); else if(n==0) printf("%d既不是负数也不 阅读全文
posted @ 2021-10-31 21:34 1只会飞猪 阅读(29) 评论(0) 推荐(0) 编辑
摘要: 1. 教材P52 例4-8 分数转成等级 switch #include<stdio.h> main() { int mark; printf("请输入学生的分数(0-100):\n"); scanf("%d",&mark); switch(mark/10) { case 10: case 9:pr 阅读全文
posted @ 2021-10-28 23:31 1只会飞猪 阅读(30) 评论(0) 推荐(0) 编辑
摘要: 1.1. 编写程序,使用scanf()函数接收整型,实型,字符型,并分别依行输出 #include<stdi.h> Main() { Int a; float b; char c; scanf(“%d,%f,%c”,&a,&b,&c); printf(“%d\n%f\n%c\n,a,b,c); } 阅读全文
posted @ 2021-10-15 19:41 1只会飞猪 阅读(27) 评论(0) 推荐(0) 编辑
摘要: 编写程序,定义两个整形变量你,赋值并输出 #include<stdio.h> main() { int a=2; int b=6; printf("%d %d\n",a,b); } 编写程序,定义一个单精度和双精度的变量,赋值并输出 #include<stdio.h> main() { float 阅读全文
posted @ 2021-10-13 21:19 1只会飞猪 阅读(13) 评论(0) 推荐(0) 编辑
摘要: 1;编写程序,输出”我爱学习C语言!” }#include<stdio.h> main() { printf("我爱C语言\n"); } 2.分行输出自己的班级和姓名. #include<stdio.h> main() { printf("班级:计算机2105\n姓名:杨智勇"); } 3.用*号输 阅读全文
posted @ 2021-10-08 12:35 1只会飞猪 阅读(18) 评论(0) 推荐(0) 编辑