C++大学选修课系统设计 第9页
free(q);
cout<<"\n\t\t删除课程操作成功,按任意键继续"<<endl;
return 1;
}
q = q->Next;
R = R->Next;
}
cerr<<"\n\t\t没有此课程!!\t请按任意键继续.."<<endl;
return 1;
}
int menu_2_5(studentdb *X,subjectdb *P) //填写成绩
{
subjectdb *q=P->Next;
char M[20],N[20],NA[20];
float score;
system("cls");
cout<<"\n\n\t\t\t\t 填写成绩操作\n"<<endl;
if(q!=NULL)
cout<<"\n\t\t\t课程名称\t\t选课人数\n"<<endl;
else
{
cout<<"\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)
{
cout<<"\n\n\t\t请填写选修"<<M<<"的学生成绩\n"<<endl;
cout<<"\n\t\t\t姓名\t\t成绩"<<endl;
}
if(K==NULL)
cerr<<"\n\t\t\t无任何信息!!请按任意键继续.."<<endl;
while(K)
{
cout<<"\n\t\t\t"<<K->tname<<"\t\t ";
cin>>score;
studentdb *XX = X->Next;
while(XX)
{
XX->stu.getname(NA);
if(strcmp(NA,K->tname)==0)
XX->stu.wrecourse(M,score);
XX = XX->Next;
}
K = K->Next;
}
if(K==NULL)
cout<<"\n\t\t填写成绩完毕!!请按任意键继续.."<<endl;
return 1;
}
q = q->Next;
}
cerr<<"\n\t\t没有此课程!!请按任意键继续.."<<endl;
return 1;
}
int menu_2_6(subjectdb *P) //更改学分
{
float k;
system("cls");
cout<<"\n\n\n\t\t\t\t更改学分操作\n"<<endl;
subjectdb *q = P->Next;
char N[20],M[20];
if(q!=NULL)
cout<<"\n\n\n\t\t 所有课程如下:\n"<<endl;
else
{
cerr<<"\n\n\n\t\t对不起,暂时没有任何可选课程。请按任意键继续.."<<endl;
return 1;
}
while(q)
{
q->sub.getkname(N);
cout<<"\t\t\t\t "<<N<<endl;
q = q->Next ;
}
q = P->Next;
cout<<"\n\n\n\t\t请输入要改的课程 :";
cin>>M;
while(q)
{
q->sub.getkname(N);
if(strcmp(N,M)==0)
{
cout<<"\n\t\t\t原来学分为 :"<<q->sub.readcredit()<<endl;
cout<<"\n\t\t\t现要更改为 :";
cin>>k;
q->sub.getcredit(k);
cout<<"\n\t\t更改课程学分成功,按任意键继续"<<endl;
return 1;
}
q = q->Next;
}
cerr<<"\n\t\t无此课程!!请按任意键继续.."<<endl;
return 1;
}
int menu_2_7(studentdb *P) //学生情况
{
studentdb *q=P->Next;
char N[20];
system("cls");
cout<<"\n\n\n\t\t\t\t学生情况操作\n"<<endl;
if(q!=NULL)
cout<<"\n\n\n\t\t所有学生名单如下:\n"<<endl;
else
{
cerr<<"\n\n\n\t\t对不起,暂时没有学生名单!请按任意键继续.."<<endl;
return 1;
}
while(q)
{
q->stu.getname(N);
cout<<"\t\t\t\t"<<N;
cout<<endl;
q = q->Next ;
}
cout<<"\n\t\t按任意键继续.."<<endl;
return 1;
}
int menu_2_8(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 menu_2_9(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;
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] 下一页