摘要: 实验任务一: #include <stdio.h> #include <stdlib.h> int main() { FILE *fin, *fout; // 定义文件类型指针 int ch; fin = fopen("file1.txt", "r"); // 以只读文本方式打开文件file1.tx 阅读全文
posted @ 2021-06-15 18:40 文雨zyf 阅读(48) 评论(2) 推荐(0) 编辑
摘要: 实验任务一 #include<stdio.h> #include<stdlib.h> #include<string.h> #define N 3 // 运行程序输入测试时,可以把N改小一些输入测试 typedef struct student { int id; /*学生学号 */ char na 阅读全文
posted @ 2021-06-09 17:08 文雨zyf 阅读(22) 评论(1) 推荐(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" 阅读全文
posted @ 2021-05-27 16:51 文雨zyf 阅读(36) 评论(2) 推荐(0) 编辑
摘要: #include <stdio.h> long long fun(int n); // 函数声明 int main() { int n; long long f; while(scanf("%d", &n) != EOF) { f = fun(n); // 函数调用 printf("n = %d, 阅读全文
posted @ 2021-05-03 09:02 文雨zyf 阅读(40) 评论(2) 推荐(0) 编辑
摘要: 实验任务一: // 生成N个0~99之间的随机整数,并打印输出 #include <stdio.h> #include <stdlib.h> #include <time.h> #define N 5 int main() { int x, n; srand(time(0)); // 以当前系统时间 阅读全文
posted @ 2021-04-13 21:59 文雨zyf 阅读(65) 评论(2) 推荐(0) 编辑
摘要: 一、实验任务一 %04d表示四位存储,当不足四位的时候左侧用0来补齐,这样就可以将整个字符串规范化 二、实验任务二 三、实验任务三 四、实验任务四 五、实验任务五 六、实验任务六 阅读全文
posted @ 2021-03-29 20:14 文雨zyf 阅读(51) 评论(2) 推荐(0) 编辑
摘要: 实验任务一: 实验任务二: int为整型而float为浮点型,前者显示小数点后的数字而后者能显示小数点后的数字 实验任务三: 由于是整型变量,当数值是奇数的时候,除以2后小数点后的数字被抹去,最终影响最后结果。 实验任务4: 实验总结: 通过本次实验,我主要体会到了整型与浮点型常量的不同,运算顺序对 阅读全文
posted @ 2021-03-14 21:46 文雨zyf 阅读(47) 评论(0) 推荐(0) 编辑