输入一批学生的成绩(至少包括学生学号、姓名、课程成绩),用单链表存储,输出大于平均成绩的学生信息。实现代码
#include
#include
#include
#include
#include
using namespace std; struct link *AddNode(struct link *head); void ShowNode(struct link*head); void DeleteMemory(struct link *head); void ShowYouSheng(struct link *head); struct link *DeleteNode(struct link *head, char NodeDate[100]); struct link *InsertNode(struct link *head); struct link { int grade; char name[100]; char stunum[100]; struct link *next; }; int main() { char c; int i = 0; struct link *head = NULL; cout<<"是否录入学生信息?(Y/N)"<
>c; while(c == 'Y') { head = AddNode(head); //ShowNode(head); cout<<"是否继续录入新的学生信息?(Y/N)"<
>c; i ++; } cout<
<<"位同学的信息以录入!"<
输入1,删除->2,重新输入->3;退出->0"<
>b; if(b == 3) { ; } else if(b == 2) { cout<<"请输入要删除的同学的学号"<
>Deletestunum; DeleteNode(head,Deletestunum); cout<<"下面是更改后的同学列表"<
next != NULL) { pr = pr->next; } pr->next = p; } cout<<"请分别输入学生姓名、学号、成绩"<
>name >>stunum >>grade; p->name = name; p->stunum = stunum; p->grade = grade;*/ cin>>p->name; cin>>p->stunum; cin>>p->grade; p->next = NULL; return head; } void ShowNode(struct link *head) { struct link *p = head; int j = 1; while (p != NULL) { cout<
<<' '<
name<<' '<
stunum<<' '<
grade<