用C 编写一个程序:统计学生的成绩信息
#include #include using namespace std;#define max 20typedef struct _Student{ string name; string id; float math, com, eng, total; //对应为数学,计算机,英语,总分}Student;void search(Student data[]){ //找人并显示 string id; cout>id; for (int i=0; iname = b->name; a->id = b->id; a->math = b->math; a->eng = b->eng; a->...全部
#include #include using namespace std;#define max 20typedef struct _Student{ string name; string id; float math, com, eng, total; //对应为数学,计算机,英语,总分}Student;void search(Student data[]){ //找人并显示 string id; cout>id; for (int i=0; iname = b->name; a->id = b->id; a->math = b->math; a->eng = b->eng; a->com = b->com; a->total = b->total;}void sort(Student data[]){//排序 for(int i=0; i>data[i]。
name; cout>data[i]。id; cout>data[i]。math; cout>data[i]。eng; cout>data[i]。com; data[i]。total = (data[i]。
math data[i]。eng data[i]。com)/3。f; i ; cout>c; }while (i}void displayAll(Student data[]){//显示全部 for (int i=0; i if (data[i]。
total != -1){ cout } }}void init(Student data[]){ for (int i=0; i data[i]。
name = " "; data[i]。id = " "; data[i]。math = 100。f; data[i]。eng = 100。f; data[i]。com = 100。f; data[i]。
total = -1。
f; }}int main(){ Student data[max]; init(data); input(data); sort(data); displayAll(data); statistics(data); return 0;}。收起