摘要: 1.定义圆形半径,求面积 public class Text { public static void main(String[] args) { // TODO Auto-generated method stub int r=2; double b=3.14*r*r; System.out.pr 阅读全文
posted @ 2023-03-20 19:09 aaa橘子酱 阅读(26) 评论(0) 推荐(0)
摘要: 1.实现一个菜单 可以切换 ,可以返回主菜单 主菜单 1.登录 2.注册 3.输出水仙花数 4.退出程序 请选择: 选择后实现对应的功能 #include<stdio.h> #include <string.h> void login(); void mainMenu(); void rigist( 阅读全文
posted @ 2021-12-04 14:45 aaa橘子酱 阅读(46) 评论(0) 推荐(0)
摘要: 1编写程序,统计字符串中大写字母的个数。 #include<stdio.h> main(){ char str[50]; int i=0; int length=0; gets(str); while(str[i]!='\0'){ if(str[i]>='A'&&str[i]<='Z') lengt 阅读全文
posted @ 2021-11-27 16:36 aaa橘子酱 阅读(11) 评论(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-20 15:47 aaa橘子酱 阅读(28) 评论(0) 推荐(0)
摘要: 1. 猜数字: 随机产生一个0-99的数,猜猜看 如果大了 就提示大了点 如果小了 就提示小了点 直到猜对为止 #include <stdio.h> #include <stdlib.h> #include <time.h> int main() { int a,b,c; srand((unsign 阅读全文
posted @ 2021-11-16 17:31 aaa橘子酱 阅读(6) 评论(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"); } } 2.输出以下图形 #include<stdio.h> main( 阅读全文
posted @ 2021-11-14 21:52 aaa橘子酱 阅读(29) 评论(0) 推荐(0)
摘要: 1.编写程序,使用while语句求和sum=1+3+5+......+21 #include<stdio.h> main(){ int i=1,sum=0; while(i<=21){ if(i%2!=0) sum+=i; i++; } printf("sum=%d\n",sum); } 2编写程序 阅读全文
posted @ 2021-11-08 20:46 aaa橘子酱 阅读(39) 评论(0) 推荐(0)
摘要: 1.编写程序判断n是正数还是负数。 #include <stdio.h> main() { int n; printf("请输入一个数字"); scanf("%d",&n); if(n>0) printf("这个数字是正数"); else if(n==0) printf("这个数字是0"); els 阅读全文
posted @ 2021-10-30 22:01 aaa橘子酱 阅读(6) 评论(0) 推荐(0)
摘要: 1. 分数转成等级 switch #include<stdio.h> main() { int mark; printf("请输入学生的分数(0-100):\n"); scanf("%d",&mark); switch(mark/10) { case 10: case 9:printf("A\n") 阅读全文
posted @ 2021-10-30 21:47 aaa橘子酱 阅读(20) 评论(0) 推荐(0)
摘要: 1.编写一个程序,判断一个数n是正数还是负数。 #include<stdio.h> main() { float n; scanf("%f",&n); if(n>0){ printf("正数\n"); }else if(n==0){ printf("既不是正数,也不是负数\n"); }else{ p 阅读全文
posted @ 2021-10-23 15:54 aaa橘子酱 阅读(37) 评论(0) 推荐(0)