摘要: 任务三 运行程序,观察在屏幕上正确输出了按分数由高到底排序的学生信息,生成了file4.dat,直观可读。 任务四 子任务1:运行程序,观察在屏幕上正确输出了按分数由高到底排序的学生信息,生成了文件,但是不可读。 子任务2: #include<stdio.h> #include<stdlib.h> 阅读全文
posted @ 2021-01-01 14:59 铁盒半岛 阅读(56) 评论(0) 推荐(0) 编辑
摘要: 实验任务1 1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<string.h> 4 #define N 3 5 6 typedef struct student { 7 int id; 8 char name[20]; 9 char subje 阅读全文
posted @ 2020-12-25 12:35 铁盒半岛 阅读(48) 评论(0) 推荐(0) 编辑
摘要: 任务1 #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\ 阅读全文
posted @ 2020-12-17 21:35 铁盒半岛 阅读(49) 评论(0) 推荐(0) 编辑
摘要: 实验任务一 答:因为每个函数的返回值只有一个,所以一元二次方程的根不可以设计成函数返回值。 实验任务二 // 利用局部static变量计算阶乘 #include <stdio.h> long long fac(int n); // 函数声明 int main() { int i,n; printf( 阅读全文
posted @ 2020-12-03 23:26 铁盒半岛 阅读(57) 评论(0) 推荐(0) 编辑
摘要: 任务1 #include<math.h> #include<stdio.h> int main(){ float a, b, c, x1, x2; float delta, real, imag; printf("Enter a, b, c: "); while(scanf("%f%f%f",&a, 阅读全文
posted @ 2020-11-20 14:17 铁盒半岛 阅读(85) 评论(0) 推荐(0) 编辑
摘要: 任务1 //ex1.cpp #include <stdio.h> int main() { int a=5, b=7, c=100,d, e, f; d=a/b*c; e=a*c/b; f=c/b*a; printf("d=%d, e=%d, f=%d\n",d,e,f); return 0; } 阅读全文
posted @ 2020-11-06 12:53 铁盒半岛 阅读(57) 评论(0) 推荐(0) 编辑