摘要: 1. 定义圆形半径,求面积。 package mnb; import java.util.Scanner; public class b { public static void main(String[] args) { // TODO Auto-generated method stub Sca 阅读全文
posted @ 2023-03-22 14:56 绫小路 阅读(20) 评论(0) 推荐(0)
摘要: 1.实现一个菜单. #include <stdio.h> #include <string.h> void mainMenu(); void login(); void regist(); void shuiXianHua(); void returnToMenu(); main() { mainM 阅读全文
posted @ 2021-11-30 10:46 绫小路 阅读(20) 评论(0) 推荐(0)
摘要: 编写程序,统计字符串中大写字母的个数。 #include<stdio.h> main() { char str[20]; int i,cnt; cnt=i=0; gets(str); while(str[i]!='\0') { if(str[i]>='A'&&str[i]<='Z') cnt++; 阅读全文
posted @ 2021-11-23 09:56 绫小路 阅读(17) 评论(0) 推荐(0)
摘要: 定义一个含有8个存储单元的实型数组,从键盘上接收数,然后逆序输出, #include<stdio.h> main() { double m[8]; int i; for(i=0;i<=7;i++) scanf("%lf",&m[i]); for(i=7;i>=0;i--) printf("%f",m 阅读全文
posted @ 2021-11-16 10:52 绫小路 阅读(15) 评论(0) 推荐(0)
摘要: 1.输出图形 #include<stdio.h> main() { int i,j; for(i=1;i<=5;i++){ for(j=1;j<=i;j++){ printf("*"); } printf("\n"); } } #include<stdio.h> main() { int i,j,k 阅读全文
posted @ 2021-11-16 10:49 绫小路 阅读(69) 评论(0) 推荐(0)
摘要: 1.编写程序,使用while语句求和sum=1+3+5+…+21. #include<stdio.h> main() { int i=1;int sum=0; while(i<=21) { sum+=i; i+=2; } printf("Sum=%d\n",sum); } 2.编写程序,使用whil 阅读全文
posted @ 2021-11-05 20:21 绫小路 阅读(31) 评论(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 阅读全文
posted @ 2021-10-29 19:02 绫小路 阅读(32) 评论(0) 推荐(0)
摘要: 编写程序,判断一个数n是正数还是负数。 #include<stdio.h> main() { float n; scanf("%f",&n); if(n>0) printf("正数!\n"); else if(n==0) printf("0既不是正数,也不是负数!\n"); else printf( 阅读全文
posted @ 2021-10-23 17:14 绫小路 阅读(32) 评论(0) 推荐(0)
摘要: 1. #include <stdio.h> main(){ int a=1 ; int b=2; printf("%d %d\n",a,b); } 2. #include <stdio.h> main(){ float a=1.23; double b=2.56; printf("%f %lf\n" 阅读全文
posted @ 2021-10-16 09:51 绫小路 阅读(20) 评论(0) 推荐(0)
摘要: 编写程序,输出“我爱学习c语言!”。 #include<stdio.h> main() { printf("我爱学习c语言!"); } 2.分行输出自己的专业和姓名 #include<stdio.h> main() { printf("计算机科学与技术\n"); printf("陶鑫宇\n"); } 阅读全文
posted @ 2021-10-03 17:40 绫小路 阅读(50) 评论(0) 推荐(0)