int couInform(subjectdb *P) //选课情况
{
subjectdb *q = P->Next;
char M[20],N[20];
system("cls");
cout<<"\n\n\t\t\t\t选课情况操作"<<endl;
if(q!=NULL)
{
cout<<"\n\n\n\t\t所有选课情况如下:\n"<<endl;
cout<<"\n\t\t\t课程名称\t\t选课人数\n"<<endl;
}
else
{
cerr<<"\n\n\n\t\t对不起,暂时没有课程!!请按任意键继续.."<<endl;
return 1;
}
while(q)
{
q->sub.getkname(N);
cout<<"\t\t\t"<<N<<setw(28-strlen(N))<<q->sub.retactivestudent()<<endl;
q = q->Next ;
}
q = P->Next;
cout<<"\n\t请输入课程名称 :";
cin>>M;
while(q)
{
q->sub.getkname(N);
studentname *K = q->sub.retfirst();
if(K!=NULL)
K = K->Next;
if(strcmp(N,M)==0)
{
system("cls");;
if(K==NULL)
{
cerr<<"\n\n\t无任何选课信息!!\t请按任意键继续.."<<endl;
return 1;
}
cout<<"\n\n\n\t\t选修"<<M<<"课的学生名单如下:\n"<<endl;
cout<<"\n\t\t\t姓名\t\t 成绩"<<endl;
while(K)
{
cout<<"\n\t\t\t"<<K->tname<<setw(20-strlen(K->tname))<<K->result<<endl;
K = K->Next;
}
cout<<"\n\t\t请按任意键继续.."<<endl;
return 1;
}
q = q->Next;
}
cerr<<"\n\t\t无此课程!!\t请按任意键继续.."<<endl;
return 1;
}
int save(studentdb *Y,subjectdb *P) //保存数据
{
studentdb *Z = Y->Next;
subjectdb *X = P->Next;
system("cls");
fstream file("subject.txt",ios::out);
while(X)
{
file.write ((char *)&(X->sub),sizeof(X->sub));
X = X->Next;
}
file.close();
www.751com.cn
file1.write ((char *)&(Z->stu),sizeof(Z->stu));
int time = Z->stu.retfactcourse();
course *co = Z->stu.retroot(),*co1;
if(co!=NULL)
co1 = co->Next;
while(time)
{
file2.write((char *)(co1),sizeof(*co1));
co1 = co1->Next;
time = time - 1;
}
Z = Z->Next;
}
file2.close ();
file1.close();
cout<<"\n\n\n\t\t\t保存数据成功!按任意键继续.."<<endl;
return 1;
}
int main()
{
subjectdb *P = new subjectdb,*Q=P;
P->Next = NULL;
subject M;
fstream file("subject.txt",ios::in);
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] 下一页