随笔分类 -  C语言填空

摘要:#include <stdio.h> //从键盘输入一个字符串,将字符串中出现的所有大写字母循环右移5位 【1】 main() { char s[30]; int i=0,n; 【1】; n=strlen(s); while(【1】) { if(【1】) s[i]=s[i]+5; if(【1】) 【 阅读全文
posted @ 2023-03-22 08:49 myrj 阅读(115) 评论(0) 推荐(0)
摘要:#include <stdio.h> main() { 【1】 ch[80]; int i; printf("请输入一个字符串:"); gets(【2】); for(i=0;ch[i]!= '【3】';i++) { if(ch[i]>='A'【4】ch[i]<='Z') ch[i]=ch[i]+32 阅读全文
posted @ 2023-02-27 09:38 myrj 阅读(258) 评论(0) 推荐(0)
摘要:#include <stdio.h> main() { int year,flag; printf("请输入年份:"); 【1】; 【2】 printf("年份超出范围。"); else { if(year%4==0) { 【3】 { if(year%400==0) flag=1; 【4】 flag 阅读全文
posted @ 2023-02-27 09:34 myrj 阅读(134) 评论(0) 推荐(0)
摘要:/*程序功能: 输入一个不大于4位正整数,判断它是几位数,然后输出各位之积。*/ #include <stdio.h> main() { int a,【1】,【2】,b; scanf("%d",&a); 【3】=a; if(【4】) { do{ wei++; cj=【5】; a=【6】; }whil 阅读全文
posted @ 2023-02-26 07:53 myrj 阅读(188) 评论(0) 推荐(0)
摘要:#include <stdio.h> // 实现两个字符串的连接(不使用库函数),即把字符串s2连接到字符串s1的后面 【1】 main() { char s1[80],s2[20]; int 【2】,【3】; 【4】(s1); 【5】(s2); while(【6】) { i++; } while( 阅读全文
posted @ 2023-02-26 07:01 myrj 阅读(932) 评论(0) 推荐(0)
摘要:/* 编写程序,输入一个学生的生日(年:y0、月:m0、日:d0); 并输入当前的日期(年:y1、月:m1、日:d1);输出学生的实际年龄周岁*/ #include <stdio.h> main() { int y0,m0,d0,y1,m1,d1,r; printf("请输入生日:\n"); sca 阅读全文
posted @ 2023-02-24 07:03 myrj 阅读(241) 评论(0) 推荐(0)
摘要:#include <stdio.h> //不用abs() fabs()函数输出任意整数的相反数 main() { int a,b; scanf("%d",&a); b=【1】; printf("%d的相反数为%d",a,b) ; getchar(); } #include <stdio.h> //不 阅读全文
posted @ 2023-02-24 06:15 myrj 阅读(194) 评论(0) 推荐(0)
摘要:#include <stdio.h> //计算用1分钱 2分钱 5分钱组成1元钱的方式 //要求三种钱都必须有,共有多少种组成方式,并输出相应的组成方式 //【1】【2】【3】填写最小的可能的数 main() { int a,b,c,d=0; for(a=1;a<【1】;a++) for(b=1;b 阅读全文
posted @ 2023-02-18 16:34 myrj 阅读(269) 评论(0) 推荐(0)
摘要:#include <stdio.h> //s=1+2+6/4+10/6+16/10+26/16+.....前30项的和 main() { int i,t; float a=【1】,b=【2】,s=【3】; for(i=1;i<=【4】;i++) { s=【5】; t=【6】; a=【7】; b=t; 阅读全文
posted @ 2023-02-18 14:10 myrj 阅读(63) 评论(0) 推荐(0)
摘要:#include <stdio.h> 【1】 //逆序输出任意字符串 void severse_string(char arr【2】) { int len = strlen(arr); int left = 0; int right = len - 1; while (left < right) { 阅读全文
posted @ 2023-02-18 11:22 myrj 阅读(87) 评论(0) 推荐(0)
摘要:#include <stdio.h> 【1】 //逆序输出任意字符串 void severse_string(char【2】str) { int len = strlen(str); char* left = str; char* right = str + len - 1; while (left 阅读全文
posted @ 2023-02-18 11:19 myrj 阅读(123) 评论(0) 推荐(0)
摘要:#include <stdio.h> //逆序输出任意字符串 【1】 main() { char zf[100]; int a,b; 【2】; a=【3】; for(b=a-1;b>=0;b--) printf("%c",zf[b]); getchar(); } #include <stdio.h> 阅读全文
posted @ 2023-02-18 11:10 myrj 阅读(116) 评论(0) 推荐(0)
摘要:#include <stdio.h> //从键盘输入一个整数,如果不高于100则逆序输出,否则输出"输入范围错误" 【1】 nx(int n) { while(n) { printf("%d",【2】); 【3】; } printf("\n"); } main() { int shu,a,b; 【4 阅读全文
posted @ 2023-02-18 11:06 myrj 阅读(104) 评论(0) 推荐(0)
摘要://如果要规定上下限:a b(b>a) /// rand() %(b-a+1) + a; //产生a~b的随机数 //分析:取模即取余,rand()%51+13我们可以看成两部分:rand()%51是产生 0~50 的随机数,后面+13保证 a 最小只能是 13,最大就是 50+13=63。 //产 阅读全文
posted @ 2023-02-18 09:14 myrj 阅读(57) 评论(0) 推荐(0)
摘要:#include <stdio.h> 【1】 //利用公式求π:1-1/3+1/5...=π/4 //直到最后一项的绝对值小于0.000001为止 ,结果保留6位小数 int main(){ float s=1; float pi=0; float i=1.0; float n=1.0; while 阅读全文
posted @ 2023-02-18 08:55 myrj 阅读(323) 评论(0) 推荐(0)
摘要:#include <stdio.h> //从键盘输入10个整数,输出这10个数的最大值 最小值 平均值 main() { int cj[10],min,max,aver,n; for(n=0;【1】;n++) scanf("%d",【2】) ; 【3】cj[0]; for(n=1;n<10;n++) 阅读全文
posted @ 2023-02-17 16:39 myrj 阅读(1994) 评论(0) 推荐(0)
摘要:#include <stdio.h> //将数组中的值降序排序并输出 main() { int a[10]={12,3,5,78,98,345,23,35,67,99}; int i,j,k,t; for(i=0;【1】;i++) { 【2】; for(j=i+1;j<10;j++) if(【3】) 阅读全文
posted @ 2023-02-17 16:28 myrj 阅读(251) 评论(0) 推荐(0)
摘要:#include <stdio.h> //从键盘输入一个十进制整数,输出其二进制数 main() { int x[10],n,i,j; 【1】; scanf("%d",&n); while(【2】 { 【3】; n=【4】; 【5】; } for(【6】;j>=0;j--) printf("%d", 阅读全文
posted @ 2023-02-17 16:17 myrj 阅读(547) 评论(0) 推荐(0)
摘要:#include <stdio.h> //输出1-100间的所有除3余1且除5余2的数,每行2个 【1】 { int i,k; 【2】; for(i=1;i<=100;i++) if(【3】) { printf("%5d",i); 【4】; if(【5】) printf("\n"); } getch 阅读全文
posted @ 2023-02-17 16:11 myrj 阅读(231) 评论(0) 推荐(0)