cerr<<"\n\t\t\t输入有误!按任意键继续.."<<endl;
return 1;
}
q = P->Next;
j=0;
q=P->Next;
while(q)
{
q->stu.getname(N);
if(strcmp(N,M)==0)
j++;
if(j==k)
{
system("cls");;
course *T=q->stu.retroot();
if(T==NULL)
{
cout<<"\n\n\n\t\t\t"<<N<<"同学你还未选课! 请按任意键继续.."<<endl;
return 1;
}
if (T!=NULL)
T = T->Next;
cout<<"\n\n\n\t\t"<<N<<"同学你已选"<<q->stu.retfactcourse()<<"门课,具体如下\n\n"<<endl;
cout<<"\t\t\t课程名称\t\t成绩\n"<<endl;
while(T)
{
cout<<"\t\t\t "<<T->cname<<setw(25-strlen(T->cname))<<T->grade<<endl;
T = T->Next;
}
j=0;
}
q = q->Next;
}
cout<<"\n\t\t请按任意键继续..."<<endl;
return 1;
}
int scInform(subjectdb *P) //选课情况
{
subjectdb *q=P->Next;
char 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 ;
}
cout<<"\n\t\t请按任意键继续.."<<endl;
return 1;
}
int menu_1_4(studentdb *X,subjectdb *P) //退出系统
{
save(X,P);
tuichu();
return 0;
}
/////////////////////////////////////////////////////////////////////////////////////
//管理端功能函数
int addStudent(studentdb *P) //增加学生
{
char N[20];
system("cls");;
cout<<"\n\n\t\t\t\t增加学生操作\n"<<endl;
cout<<"\n\n\t\t请输入学生姓名:";
cin>>N;
cout<<endl<<"\t\t增加学生操作成功,按任意键继续"<<endl;
studentdb *newnode = new studentdb;
newnode->Next = P->Next ;
newnode->stu.readname(N);
P->Next = newnode ;
return 1;
}
int addCourse(subjectdb *P) //增加课程
{
float k;
char N[20],M[20];
system("cls");;
cout<<"\n\n\t\t\t\t增加课程操作\n"<<endl;
cout<<"\n\n\t\t 请输入课程名称:";
cin>>N;
cout<<endl;
subjectdb *q = P->Next;
while(q)
{
q->sub.getkname(M);
if(strcmp(N,M)==0)
{
cout<<"\n\t\t此课程已经存在,按任意键继续"<<endl;
return 1;
}
q = q->Next;
}
cout<<"\t\t输入此课程的学分:";
cin>>k;
cout<<"\n\t\t增加课程操作成功,按任意键继续"<<endl;
subjectdb *newnode = new subjectdb;
newnode->Next = P->Next ;
newnode->sub.setkname(N);
newnode->sub.getcredit(k);
P->Next = newnode ;
return 1;
}
int deleteStudent(studentdb *P) //删除学生
{
system("cls");
cout<<"\n\n\t\t\t\t删除学生操作"<<endl;
stuInform(P);
studentdb *q = P->Next;
if(q==NULL)
return 1;
int i;
char N[20],M[20];
cout<<"\n\t请输入要删除的学生姓名 :";
cin>>N;
i=0;
while(q)
{
q->stu.getname(M);
if(strcmp(N,M)==0)
i++;
q = q->Next;
}
int j=0,k=1;
if(i==0)
{
cerr<<"\n\t\t没有这个学生!!请按任意键继续.."<<endl;
return 1;
}
else if(i>1)
{
cout<<"\n\t\t共找到"<<i<<"个姓名为"<<N<<"的学生"<<endl;
cout<<"\n\t\t要删除第几个:";
cin>>k;
}
if(k>i||k<=0)
return 1;
q = P->Next;
studentdb *R = P;
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] 下一页