📄 addstuinf.cpp
字号:
#include"studentBasicInformation.h"
#include"publicHeadFile.h"
void addStuCount(int i);
//void write(studentInformation *head);
void managerRegister(); //管理员注册模块函数的声名
int managerMenuControl(); //管理员菜单控制函数的声明
void managerOperatorMenu();
void managerOperatorMenuControl();
void managerOperatorMenu();
void managerOperatorMenuControl();
studentInformation *studentInformation::addStuInf(studentInformation *head)
{
/* studentInformation stuInfor;
studentInformation *p1,*p2;
p1=p2=head;
char s_number2[16],s_number3[16];
cout<<"\n\n\n"<<endl;
loop: cout<<"\t\t\t\t┌──────────────┐"<<endl;
cout<<"\t\t\t\t│ 学 生 基 本 信 息 编 辑 │"<<endl;
cout<<"\t\t\t\t└──────────────┘"<<endl;
ifstream out("studentNumberTable.txt");//读文件中的内容
out>>s_number3;
cout<<"\n\n\t\t\t检查学号是否已存在";
cout<<"\n\n\t\t\t学号: ";
cin>>s_number2;
if(strcmp(s_number2,s_number3)==0)
{
cout<<"\n\n\t\t\t此学号已存在!"<<endl;
cout<<"\n\n\t\t\t是否继续编辑(y/n)"<<endl;
if(getch()==121)
{
system("cls");
goto loop;
}
else
{
system("cls");
cout<<"\n\t\t\t请按任意键返回上级菜单。"<<endl;
getch();
system("cls");
managerOperatorMenu();
managerOperatorMenuControl();
}
}
// else
// {
cout<<"\n\n\t\t\t此学号不存在,可以进行编辑!"<<endl;
while(p1)
{
p1=p1->next;
p2->next=p1;
p2=p1;
}
p1=new studentInformation;
while(1)
{
fan: cout<<"\n\n\t\t\t学号: ";
cin>>p1->s_number;
cout<<"\n\t\t\t姓名: ";
cin>>p1->s_name;
cout<<"\n\t\t\t性别: ";
cin>>p1->s_sex;
cout<<"\n\t\t\t年级: ";
cin>>p1->s_gread;
cout<<"\n\t\t\t班级: ";
cin>>p1->s_class;
cout<<"\n\t\t\t民族: ";
cin>>p1->s_minzhu;
cout<<"\n\t\t\t籍贯: ";
cin>>p1->s_jiguan;
cout<<"\n\t\t\t生日: ";
cin>>p1->s_birthday;
cout<<"\n\t\t\t政治面貌: ";
cin>>p1->s_zhengzhimianmao;
cout<<"\n\t\t\t寝室楼号: ";
cin>>p1->s_qinshilou_number;
cout<<"\n\t\t\t寝室号: ";
cin>>p1->s_qinshi_number;
cout<<"\n\t\t\t寝室电话: ";
cin>>p1->s_qinshi_phoneNumber;
cout<<"\n\t\t\t个人电话: ";
cin>>p1->s_lianxi_phone;
cout<<"\n\t\t\t联系地址: ";
cin>>p1->s_lianxi_address;
oo: cout<<"\n\n\n\n\n\t\t\t真的要添加吗?(y/n)"<<endl;
char mm;
mm=getch();
if(mm=='y'||mm=='Y')
{
io: cout<<"\n\n\t\t\t是否继续?(y/n)"<<endl;
char jj;
jj=getch();
if(jj=='y'||jj=='Y')
{
p1=new studentInformation;
p2->next=p1;
p2=p1;
goto fan;
}
if(jj=='n'||jj=='N')
{
p2->next=0;
// cout<<"\n\n\t\t\t★信息成功写入,按任意键返回★"<<endl;
// getch();
return head;
}
else
goto io;
}
if(mm=='n'||mm=='N')
{
if(p2==head)
return 0;
else
{
p2->next=0;
return head;
}
}
else
goto oo;
}*/
// studentInformation *p1;
// studentInformation *p=head;
// studentInformation stuInfor;
// ifstream infile;
// infile.open("学生基本信息.txt");
char ch;
int s_number;
studentInformation *p2;
cout<<"\n\n\n"<<endl;
loop: cout<<"\t\t\t\t┌──────────────┐"<<endl;
cout<<"\t\t\t\t│ 学 生 基 本 信 息 编 辑 │"<<endl;
cout<<"\t\t\t\t└──────────────┘"<<endl;
cout<<"\n\n\t\t\t检查学号是否已存在";
cout<<"\n\n\t\t\t学号: ";
// infile.open("学生基本信息.txt");
cin>>s_number;
/* do
{
if(s_number == p->s_number)
{
cout<<"\t\t";
cout<<endl;
cout<<"\n\n\t\t\t此学号已存在!"<<endl;
cout<<"\n\n\t\t\t是否继续编辑(y/n)"<<endl;
if(getch()==121)
{
system("cls");
goto loop;
}
else
{
system("cls");
cout<<"\n\t\t\t请按任意键返回上级菜单。"<<endl;
getch();
system("cls");
managerOperatorMenu();
managerOperatorMenuControl();
}
}
p=p->next;
}while(p);*/
// p1=head;
cout<<endl<<endl;
p2=new studentInformation;
p2->s_number=s_number;
cout<<"\n\t\t\t姓名: ";
cin>>p2->s_name;
cout<<"\n\t\t\t性别: ";
cin>>p2->s_sex;
cout<<"\n\t\t\t年级: ";
cin>>p2->s_gread;
cout<<"\n\t\t\t班级: ";
cin>>p2->s_class;
cout<<"\n\t\t\t民族: ";
cin>>p2->s_minzhu;
cout<<"\n\t\t\t籍贯: ";
cin>>p2->s_jiguan;
cout<<"\n\t\t\t生日: ";
cin>>p2->s_birthday;
cout<<"\n\t\t\t政治面貌: ";
cin>>p2->s_zhengzhimianmao;
cout<<"\n\t\t\t寝室楼号: ";
cin>>p2->s_qinshilou_number;
cout<<"\n\t\t\t寝室号: ";
cin>>p2->s_qinshi_number;
cout<<"\n\t\t\t寝室电话: ";
cin>>p2->s_qinshi_phoneNumber;
cout<<"\n\t\t\t个人电话: ";
cin>>p2->s_lianxi_phone;
cout<<"\n\t\t\t联系地址: ";
cin>>p2->s_lianxi_address;
// cout<<"\n\n\n\n\n\t\t\t真的要添加吗?(y/n)"<<endl;
p2->next=NULL;
// head=p2;
// ch=getch();
// if(ch=='y'||ch=='Y')
// {
head=p2;
// head=p1->next;
// p2->next=p1;
// }
// delete(p2);
/* p1=head;
cout<<"\t现在的学生信息有:"<<endl;
do
{
cout<<"\t\t"<<p1->s_name<<endl;
p1=p1->next;
}while(p1);*/
/* ofstream out;
out.open("学生基本信息.txt",ios::trunc);
out<<head->s_number<<" "<<head->s_name<<" "<<head->s_sex<<" "
<<head->s_gread<<" "<<head->s_class<<" "<<head->s_minzhu<<" "
<<head->s_jiguan<<" "<<head->s_birthday<<" "<<head->s_zhengzhimianmao
<<" "<<head->s_qinshilou_number<<" "<<head->s_qinshi_number
<<" "<<head->s_qinshi_phoneNumber<<" "<<head->s_lianxi_phone
<<" "<<head->s_lianxi_address;*/
write(head);
cout<<endl<<endl<<" * 按任意键返回主界面! * " <<endl;
getch();
system("cls");
managerOperatorMenu();
managerOperatorMenuControl();
return head;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -