摘要: 1.定义圆的半径,求面积 int r=5; double Π=3.14; System.out.println("圆的面积为"+Π*(r*r)); 2.华氏温度和摄氏温度互相转换,从华氏度变成摄氏度你只要减去32,乘以5在除以9就行了;将摄氏度转成华氏度,直接乘以9,除以5,再加上32就行 int 阅读全文
posted @ 2023-03-18 18:24 张云月 阅读(27) 评论(0) 推荐(0)
摘要: 1. 现一个菜单 可以切换 ,可以返回主菜单 主菜单 1.登录 2.注册 3.输出水仙花数 4.退出程序 请选择: 选择后实现对应的功能 #include<stdio.h> void mainMenu(); void two(); main() { mainMenu(); } void mainMe 阅读全文
posted @ 2021-12-09 11:32 张云月 阅读(18) 评论(0) 推荐(0)
摘要: 编写程序,实现strlen()函数的功能 #include<stdio.h> main() { char str[80]; int i=0; int length=0; gets(str); puts(str); while(str[i++]!='\0') length++; printf("字符串 阅读全文
posted @ 2021-11-27 20:28 张云月 阅读(18) 评论(0) 推荐(0)
摘要: 1.定义一个含有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" 阅读全文
posted @ 2021-11-17 12:54 张云月 阅读(31) 评论(0) 推荐(0)
摘要: 1.猜数字,如果大了提示大了点,小了提示小了点 #include<stdio.h> #include <stdlib.h> #include <time.h> int main() { while(1){ int a=0,b; srand((unsigned)time(NULL)); a = ran 阅读全文
posted @ 2021-11-15 21:24 张云月 阅读(47) 评论(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, 阅读全文
posted @ 2021-11-09 20:18 张云月 阅读(25) 评论(0) 推荐(0)
摘要: 编写程序,使用while语句求和sum=1+3+5+…+21. #include<stdio.h> main() { int sum=0; int a=1; while(a<=21) { sum+=a; a+=2; } printf("%d",sum); } 编写程序,使用while语句求和sum= 阅读全文
posted @ 2021-11-08 13:26 张云月 阅读(25) 评论(0) 推荐(0)
摘要: 1.编写程序判断n是正数还是负数 #include main(){ int n; printf("输入n的值\n"); scanf("%d",&n); if(n*-1<0) printf("n为正数"); else if(n*-1==0) printf("n为0"); else if(n*-1>0) 阅读全文
posted @ 2021-10-30 22:24 张云月 阅读(38) 评论(0) 推荐(0)
摘要: 编写程序,判断学生的成绩是什么等级 #include<stdio.h> main(){ int score; printf("输入学生的分数\n"); scanf("%d",&score); switch(score/10) { case 10:printf("A\n");break; case 9 阅读全文
posted @ 2021-10-27 21:53 张云月 阅读(29) 评论(0) 推荐(0)
摘要: 编写程序,判断一个数是正数还是负数 #include<stdio.h> main() { float m; scanf("%f",&m); if(m>0) printf("m为正数\n"); else if(m==0) printf("m既不是正数也不是负数\n"); else if(m<0) pr 阅读全文
posted @ 2021-10-19 21:40 张云月 阅读(23) 评论(0) 推荐(0)