摘要: 1.定义圆形半径,求面积 public class aaa { public static void main(String[] args) { // TODO Auto-generated method stub int r=4; double pai=3.14; double area; are 阅读全文
posted @ 2023-03-18 19:45 Y君莫笑X 阅读(11) 评论(0) 推荐(0)
摘要: 1.字符串的长度. 1 2 3 4 5 6 7 8 9 10 11 12 #include<stdio.h> main() { char str[80]; int i=0; int length=0; gets(str); puts(str); while(str[i++]!='\0') lengt 阅读全文
posted @ 2021-11-29 18:03 Y君莫笑X 阅读(34) 评论(0) 推荐(0)
摘要: 1编写程序,统计字符串中大写字母的个数。 #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-29 17:59 Y君莫笑X 阅读(42) 评论(0) 推荐(0)
摘要: 1.实现一个菜单 可以切换 ,可以返回主菜单 主菜单 1.登录 2.注册 3.输出水仙花数 4.退出程序 请选择: 选择后实现对应的功能 #include<stdio.h> #include<string.h> void a(); void b(); void c(); void d(); void 阅读全文
posted @ 2021-11-29 17:55 Y君莫笑X 阅读(22) 评论(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",m[i]);} 阅读全文
posted @ 2021-11-29 17:45 Y君莫笑X 阅读(71) 评论(0) 推荐(0)
摘要: 编写程序判断n是正数还是负数。 #include<stdio.h> main(){ int n; scanf("%d",&n); if(n>0) printf("正数"); else if(n==0) printf("非正非负"); else printf("负数"); } 使用条件运算符,找出a, 阅读全文
posted @ 2021-11-01 22:17 Y君莫笑X 阅读(9) 评论(0) 推荐(0)
摘要: 1.#include<stdio.h> main() { int mark; printf("输入学生的分数(0-100):"); scanf("%d",&mark); switch(mark/10) { case 10: case 9:printf("A\n"); break; case 8:pr 阅读全文
posted @ 2021-10-28 22:53 Y君莫笑X 阅读(20) 评论(0) 推荐(0)
摘要: 1.编写程序,使用scanf()函数接收整型,实型,字符型的变量,并分行依次输出。 #include<stdio.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-16 22:11 Y君莫笑X 阅读(25) 评论(0) 推荐(0)
摘要: 1.编写程序,定义两个整型变量,复制并输出。 #include<stdio.h> main() { int a=2; int b=6; printf("%d%d\n",a,b); } 2.编写程序,定义一个单精度和一个双精度的变量,赋值并输出。 #include<stdio.h> main() { 阅读全文
posted @ 2021-10-13 20:48 Y君莫笑X 阅读(17) 评论(0) 推荐(0)
摘要: 1编写程序,输出”我爱C语言” #include<stdio.h> main() { printf("我爱学习C语言!"); } 2分行输出自己的专业和姓名 #include<stdio.h> main() { printf("计算机科学与技术\n董诗萌"); } 3用*输出字母c的图案 #incl 阅读全文
posted @ 2021-10-01 16:59 Y君莫笑X 阅读(19) 评论(0) 推荐(0)