/*Name: 链表学生管理 Author: Esther' Date: 15/05/19 14:26Description: 用动态链表实现学生信息的录入和查找。并用文件输入输出。
*/#include
#include
#include
using namespace std;struct Student{unsigned long id;char name[36];float score;Student* next;
};int main()
{ifstream fin("CPP_Score.txt");ofstream fout("out.txt");Student *head,*arg1,*arg2; head= new Student;arg1=head; double id,score;char name[36];fout<<"输入id,姓名和成绩。输入0结束录入。\n"; while(fin>>id){if(id){fin>>name>>score;arg2=new Student;arg2->next=NULL;arg2->id=id;strcpy(arg2->name,name);arg2->score=score;arg1->next=arg2;arg1=arg2;}elsebreak;}// Student *i=head;
// while(i->next!=NULL){
// i=i->next;
// fout<< i->id <<" "<< i->name <<" "<< i->score <
// }fout<<"输入学号来查询,输入0结束查询。\n"; while(fin>>
学生信息管理-动态链表-c++
/*Name: 链表学生管理 Author: Esther' Date: 15/05/19 14:26Description: 用动态链表实现学生信息的录入和查
版权声明
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处。如若内容有涉嫌抄袭侵权/违法违规/事实不符,请点击 举报 进行投诉反馈!