展开全部
#include"Exp19_1.h"
#include
#include
#include
using namespace std;
class student{ //为了简化,数据域32313133353236313431303231363533e58685e5aeb931333262356138仅保留学号与姓名
int key;
string name;
public:
void putkey(int k){key=k;}
void putnam(string nam){name=nam;}
void show(){cout<
bool operator
bool operator!=(student& stu){return key!=stu.key;}
};
int main(){
int i,k;
string nam;
Node * P1;
student stu;
List list1,list2,list3;
ifstream infile;
infile.open("EXP19_1.txt",ios::in);
if(!infile){
cout<
return 1;
}
for(i=0;i<9;i++){
infile>>k;
stu.putkey(k);
infile>>nam;
stu.putnam(nam);
P1=list1.CreatNode(stu);
list1.InsertFront(P1);//向前生成list1
P1=list1.CreatNode(stu);
list2.InsertRear(P1); //向后生成list2
}
infile.close();
list1.PrintList();
cout<
cout<
list2.PrintList();
cout&l