摘要: 实验七 文件 任务三: 答:运行程序后,屏幕上确实输出了按分数从高到低顺序的信息,同时,在当前路径下,也生成了文本文件file3.dat。用记事本程序打开文件file3.dat,里面的数据信息是正确的,并且是直观可读的。 任务四: 答:运行程序后,屏幕上确实正确输出了按分数由高到底排序的学生信息。同 阅读全文
posted @ 2020-12-28 21:52 三尺有明 阅读(84) 评论(0) 推荐(0)
摘要: #include<stdio.h> #include<stdlib.h> #include<string.h> #define N 10 // 运行程序输入测试时,可以把N改小一些输入测试 typedef struct student { int id; /*学生学号 */ char name[20 阅读全文
posted @ 2020-12-20 17:02 三尺有明 阅读(109) 评论(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-15 18:51 三尺有明 阅读(105) 评论(0) 推荐(0)
摘要: 任务一:在任务一的程序中,一元二次方程的根无法设计成以函数数返回值的方式返回给主调函数。首先,教科书中提到“函数中允许有多个return语句,但每次只能有一个return语句被执行,即只能返回一个函数值”,这段话的意思就是我们可以通过条件语句出现多个return,但是函数的返回值只有一个,所有的re 阅读全文
posted @ 2020-11-30 23:32 三尺有明 阅读(106) 评论(0) 推荐(0)
摘要: #include <math.h> #include <stdlib.h> #include <stdio.h> int main() { float a, b, c, x1, x2; float delta, real, imag; printf("Enter a, b, c: "); while 阅读全文
posted @ 2020-11-16 21:35 三尺有明 阅读(61) 评论(0) 推荐(0)
摘要: #include <stdio.h> #include <stdlib.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); 阅读全文
posted @ 2020-11-04 20:15 三尺有明 阅读(76) 评论(1) 推荐(0)
摘要: /* A simple C program */ #include <stdio.h> #include <stdlib.h> int main() { printf("202083450078\n"); printf("2020是满是黑天鹅的一年,我们应当风雨兼程"); system("pause 阅读全文
posted @ 2020-10-19 16:19 三尺有明 阅读(79) 评论(0) 推荐(0)
摘要: /*循环打印字符*/ #include <stdio.h> int main () { while(1) printf("NUIST"); return 0; } 阅读全文
posted @ 2020-10-16 09:01 三尺有明 阅读(146) 评论(1) 推荐(0)
摘要: /*simple c program to 2020*/ #include <stdio.h> int main () { printf("202083450078\n"); printf("2020是一个充满挑战的一年,我将继续乘风破浪"); return 0; } 阅读全文
posted @ 2020-10-15 22:57 三尺有明 阅读(32) 评论(0) 推荐(0)