摘要: 任务3 正确输出了由高到低,生成了file3.dat 记事本打开后是正确的,直观可读。 任务4 子1:屏幕显示成功,且生成了文件file4.dat,但是不直观可读。 子2: #include<stdio.h> #include<stdlib.h> #define N 10 typedef struc 阅读全文
posted @ 2020-12-27 23:26 wuliaoisyou 阅读(50) 评论(1) 推荐(0)
摘要: #include<stdio.h> #include<stdlib.h> #include<string.h> #define N 3 typedef struct student { int id; char name[20]; char subject[20]; / float perf; fl 阅读全文
posted @ 2020-12-20 15:09 wuliaoisyou 阅读(51) 评论(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", &a[i] 阅读全文
posted @ 2020-12-11 22:17 wuliaoisyou 阅读(102) 评论(1) 推荐(0)
摘要: 任务1 不能,因为函数的返回值只能有一个。 任务2 ex2.1.cpp #include<stdio.h> long long fac(int n); int main(){ int i,n; printf("Enter n: "); scanf("%d",&n); for(i=1;i<=n;++i 阅读全文
posted @ 2020-11-28 13:07 wuliaoisyou 阅读(96) 评论(1) 推荐(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", 阅读全文
posted @ 2020-11-11 15:39 wuliaoisyou 阅读(84) 评论(1) 推荐(0)
摘要: #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; } 答:d=a÷b×c e=a× 阅读全文
posted @ 2020-10-31 13:53 wuliaoisyou 阅读(59) 评论(1) 推荐(0)