摘要: #include <stdio.h> #include <stdlib.h> int main() { FILE *fin, *fout; int ch; fin = fopen("file1.txt", "r"); if (fin == NULL) { printf("fail to open f 阅读全文
posted @ 2021-06-17 22:43 刘成瑜 阅读(31) 评论(1) 推荐(0)
摘要: #include<stdio.h> #include<stdlib.h> #include<string.h> #define N 2 // 运行程序输入测试时,可以把N改小一些输入测试 typedef struct student { int id; /*学生学号 */ char name[20] 阅读全文
posted @ 2021-06-08 23:11 刘成瑜 阅读(46) 评论(2) 推荐(0)
摘要: #include<stdio.h> const int N=3; int main(){ int a[N]={1,2,3}; int i; printf("通过数组名和下标直接访问元素:\n"); for(i=0;i<N;i++){ printf("%d:%d\n",&a[i],a[i]); } p 阅读全文
posted @ 2021-05-26 23:31 刘成瑜 阅读(56) 评论(1) 推荐(0)
摘要: #include<stdio.h> void dec2n(int x,int n); int main(){ int x; printf("输入一个十进制数:"); scanf("%d",&x); dec2n(x,2); dec2n(x,8); dec2n(x,16); return 0; } vo 阅读全文
posted @ 2021-04-27 21:43 刘成瑜 阅读(76) 评论(1) 推荐(0)
摘要: #include<math.h> #include<stdio.h> void solve(double a,double b,double c); int main(){ double a,b,c; printf("Enter a,b,c:"); while(scanf("%lf%lf%lf",& 阅读全文
posted @ 2021-04-14 22:49 刘成瑜 阅读(100) 评论(3) 推荐(0)
摘要: #include<stdio.h> #include<math.h> int main() { int sum,a0,n; double q; q=2,a0=1; scanf("%d",&n); sum=a0*(1-pow(q,n+1))/(1-q); printf("n=%d时,sum=%d\n" 阅读全文
posted @ 2021-03-31 16:00 刘成瑜 阅读(95) 评论(3) 推荐(0)
摘要: //打印一个小人字符 #include<stdio.h> int main(){ printf(" O\n"); printf("<H>\n"); printf("I I\n"); return 0; } 实验总结 一,通过本次实验,我清楚的了解了键盘大小写的转换,int与float的区别等等。 二 阅读全文
posted @ 2021-03-14 22:46 刘成瑜 阅读(90) 评论(0) 推荐(0)