学生管理系统源代码
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
cin>>targetNum;
modify_Num(targetNum);
cout<<endl;
display();
}
if(key == 2)
{
char targetName[20];
cout<
cin>>targetName;
modify_Name(targetName);
cout<<endl;
display();
}
if(key == 3)
{
exit(0);
}
*/
show_Start();
menu_CMD();
return 0;
}
void show_Start()
{
void show_Table()
{
cout<<" <<"\t"<<" "<<"\t"<<"
cout<<"\t"<<subject[0]<<"\t"<<subject[1]<<"\t"<<subject[2]; cout<<endl;
}
void menu_CMD()
{
int key;
while(1)
{
cout<<"1. <<endl; cout<<"2. <<endl; cout<<"3. <<endl; cout<<"4. <<endl; cout<<"5. <<endl; cout<<"6. <<endl; cout<<"
cin>>key;
while(1)
{
if((key < 1)||(key > 6)) {
int key;
cout<< "<<endl; cout<< (1 - 5) : " cin>>key;
}
else
{
break;
}
}
switch(key)
{
case 1:
addRecord();
break;
case 2:
deleteRecord();
break;
case 3:
modifyRecord();
break;
case 4:
queryRecord();
break;
case 5:
display();
break;
case 6:
quit();
break;
}
}
}
um;
cout<<" : "; cin>>record[stuNum].name; cout<<"(M , F) : "; cin>>record[stuNum].sex;
int i;
for(i = 0;i < SUBJECT_NUM;i++) {
cout<<" "<<subject[i]<< cin>>record[stuNum].score[i];
}
}
if((choi == 'N')||(choi == 'n')) {
cout<<" <<endl;
cout<<endl;
}
cout<< <<stuNum<<" cout<<endl;
!"<<endl;
}
"<<endl;
cout<<"2. <<endl;
cout<<"3. "<<endl;
}
um == tarNum) {
if(i = stuNum)
{
cout<<" : "<<endl; show_Table();
cout<<record[i].num<<"\t"<<record[i].name<<"\t"<<record[i].sex<<"\t" <<record[i].score[0]<<record[i].score[1]<<"\t"<<record[i].score[2]; cout<<endl;
cout<<endl<<" : "<<endl;
show_Table();
for(int i = 1;i <= stuNum - 1;i++)
{ cout<<record[i].num<<"\t"<<record[i].name<<"\t"<<record[i].sex;
for(int j = 0;j < SUBJECT_NUM;j++)
{ cout<<"\t"<<record[i].score[j];
} cout<<endl;
}
/*
stuNum--;
cout<<" <<stuNum<<";
cout<<endl;
*/
}
if(i != stuNum)
{
cout<<" : "<<endl;
show_Table();
cout<<record[i].num<<"\t"<<record[i].name<<"\t"<<record[i].sex<<"\t"
<<record[i].score[0]<<"\t"<<record[i].score[1]<<"\t"<<record[i].score [2];
for(int j = i+1;j <= stuNum;j++)
{
record[j-1] = record[j];
}
um<<"\t"<<record[i].name<<"\t"<<record[i].sex;
for(int j = 0;j < SUBJECT_NUM;j++)
{
cout<<"\t"<<record[i].score[j];
}
cout<<endl;
}
/*
stuNum--;
cout<<" "<<stuNum<<"
cout<<endl;
*/
}
stuNum--;
cout<<" "<<stuNum<< cout<<endl;
}
}
}
/*
ame,tarName) == 0)
{
um<<"\t"<<record[i].name<<"\t"<<record[i].sex<<"\t"
<<record[i].score[0]<<record[i].score[1]<<"\t"<<record[i].score[2];
cout<<endl;
cout<<endl<<" : "<<endl;
show_Table();
for(int i = 1;i <= stuNum - 1;i++)
{
cout<<record[i].num<<"\t"<<record[i].name<<"\t"<<record[i].sex;
for(int j = 0;j < SUBJECT_NUM;j++)
{
cout<<"\t"<<record[i].score[j];
}
cout<<endl;
}
}
/
if(i != stuNum)
{
cout<<" : "<<endl; show_Table();
cout<<record[i].num<<"\t"<<record[i].name<<"\t"<<record[i].sex<<"\t" <<record[i].score[0]<<"\t"<<record[i].score[1]<<"\t"<<record[i].score [2];
um<<"\t"<<record[i].name<<"\t"<<record[i].sex;
for(int j = 0;j < SUBJECT_NUM;j++)
{ cout<<"\t"<<record[i].score[j];
}
cout<<endl;
}
cout<<endl;
} void delete_Name(char tarName[])
{
int i;
for(i = 1;i <= stuNum;i++)
{ ame,tarName) == 0)
{
if(i == stuNum)
{
cout<<" : "<<endl;
show_Table();
cout<<record[i].num<<"\t"<<record[i].name<<"\t"<<record[i].sex<<"\t"
<<record[i].score[0]<<"\t"<<record[i].score[1]<<"\t"<<record[i].score [2];
cout<<" : "<<endl;
show_Table();
for(int i = 1;i <= stuNum-1;i++)
{
cout<<record[i].num<<"\t"<<record[i].name<<"\t"<<record[i].sex;
for(int j = 0;j < SUBJECT_NUM;j++)
{
cout<<"\t"<<record[i].score[j];
}
cout<<endl;
}
/*
stuNum--;
cout<<" "<<stuNum<<" ";
cout<<endl;
*/
}
/
if(i != stuNum)
{
cout<<" "<<endl;
show_Table();
cout<<record[i].num<<"\t"<<record[i].name<<"\t"<<record[i].sex<<"\t";
cout<<record[i].score[0]<<"\t"<<record[i].score[1]<<"\t"<<record[i].s core[2];
cout<<endl;
for(int j = i+1;j <= stuNum;j++)
{
record[j-1] = record[j];
}
cout<<" : "<<endl;
cout<<endl;
show_Table();
for(int i = 1;i <= stuNum-1;i++)
{
cout<<record[i].num<<"\t"<<record[i].name<<"\t"<<record[i].sex;
for(int j = 0;j < SUBJECT_NUM;j++)
{
cout<<"\t"<<record[i].score[j];
}
cout<<endl;
}
/*
stuNum--;
cout<<" "<<stuNum<<
cout<<endl;
*/
}
stuNum--;
cout<<" <<stuNum<< ";
cout<<endl;
}
}
}
/********************************************************************
*********
*********************************************************************
*********/
void Info_modify()
{
cout<<"\ : "<<endl;
cout<<"1. "<<endl;
cout<<"2. "<<endl;
cout<<"3. "<<endl;
}
void modifyRecord()
{ int key; cout<<endl;
Info_modify(); cout<<" : "; cin>>key;
um == tarNum)
{ cout<<endl<<" "<<endl; cout<<" : ";
cin>>record[i].num; cout<<" : ";
cin>>record[i].name; cout<<";
cin>>record[i].sex; cout<<" "<<subject[0]<<" "; cin>>record[i].score[0];
cout<<" "<<subject[1]<<" : "; cin>>record[i].score[1]; cout<<" "<<subject[2]<< "; cin>>record[i].score[2]; } } }
void modify_Name(char tarName[])
{
int i;
for(i = 1;i <= stuNum;i++)
{
if(strcmp(record[i].name,tarName) == 0) {
cout<<endl<<" : "<<endl;
cout<<" : "; cin>>record[i].num;
cout<<" : "; cin>>record[i].name;
cout<<" : "; cin>>record[i].sex;
cout<<" "<<subject[0]<<" : "; cin>>record[i].score[0]; cout<<" "<<subject[1]<<" : " cin>>record[i].score[1]; cout<<" "<<subject[2]<<" : ";
cin>>record[i].score[2];
}
}
}
void Info_query()
{
cout<<" : "<<endl; cout<<"1. "<<endl;
cout<<"2. "<<endl;
cout<<"3. "<<endl;
}
if(key == 3)
{
while(1)
{
menu_CMD();
}
void query_Num(int tarNum)
{
int i;
for(i = 1;i <= stuNum;i++)
{
if(record[i].num == tarNum)
{
um<<"\t"<<record[i].name<<"\t"<<record[i].sex;
cout<<"\t"<<record[i].score[0]<<"\t"<<record[i].score[1]<<"\t"<<recor d[i].score[2];
cout<<endl;
}
}
}
ame,tarName) == 0)
{
cout<<" : "<<endl;
show_Table();
cout<<record[i].num<<"\t"<<record[i].name<<"\t"<<record[i].sex;
cout<<"\t"<<record[i].score[0]<<"\t"<<record[i].score[1]<<"\t"<<recor d[i].score[2];
cout<<endl;
}
}
}
um<<"\t"<<record[i].name<<"\t"<<record[i].sex;
for(j = 0;j < SUBJECT_NUM;j++)
{
cout<<"\t"<<record[i].score[j];
}
cout<<endl;
}
cout<<endl;
}
//
void quit()
{
char choi;
cout<<" "<<endl;
cout<<" (Y/N) : ";
cin>>choi;
if((choi == 'Y')||(choi == 'y')) {
cout<< "<<endl;
exit(0);
}
/ else
{
cout<<endl; menu_CMD();。