📄 add_user.cpp
字号:
/**************
添加用户
***************/
#include "Function.h"
void InfoManager::AddSTU()
{
Unit *q;
string name;
string pwd;
int sex, old, cla;
long id;
int math, chs, eng;
cout<<"\n\t -==请输入学生的以下信息==- \n"<<endl;
cout<<endl<<"学号: ";
cin>>id;
cin.sync();
cout<<endl<<"姓名: ";
cin>>name;
cout<<endl<<"密码: ";
cin>>pwd;
cout<<endl<<"性别(为简化输入,男输入0,女以输入1): ";
cin>>sex;
cout<<endl<<"年龄: ";
cin>>old;
cout<<endl<<"班级: ";
cin>>cla;
cout<<endl<<"数学成绩: ";
cin>>math;
cout<<endl<<"语文成绩: ";
cin>>chs;
cout<<endl<<"英语成绩: ";
cin>>eng;
q=new Unit (name, pwd, sex, old, cla, id, math, chs, eng, 0);//学生,Authority==0
q->next=NULL;
if (head_stu)//头结点不空的情况
{
Unit *t;
t=head_stu;
if (t->ID==id)//判断头结点
{
cout<<"学号已存在,请重新输入"<<endl;
return;
}
while (t->next)
{
if (t->ID==id)
{
cout<<"学号已存在,请重新输入"<<endl;
return;
}
t=t->next;
}
t->next=q;
}
else//头结点空
{
head_stu=q;//头结点被赋值q
}
Unit::isModified=1;
}
void InfoManager::AddTEA()
{
Unit *q;
string name;
string pwd;
int sex, old, cla, math, chs;
long id;
cout<<"\n\t -==请输入教师的以下信息==- \n"<<endl;
cout<<"ID号: ";
cin>>id;
cin.sync();
cout<<"姓名: ";
cin>>name;
cout<<"密码: ";
cin>>pwd;
cout<<"性别(为简化输入,男输入0,女以输入1): ";
cin>>sex;
cout<<"年龄: ";
cin>>old;
cout<<"班级: ";
cin>>cla;
cout<<"月薪: ";
cin>>math;
cout<<"工龄: ";
cin>>chs;
q=new Unit (name, pwd, sex, old, cla, id, math, chs, 0, 1);//教师,Authority==1
q->next=NULL;
if (head_tea)//头结点不空的情况
{
Unit *t;
t=head_tea;
if (t->ID==id)//判断头结点
{
cout<<"此ID已存在,请重新输入"<<endl;
return;
}
while (t->next)
{
if (t->ID==id)
{
cout<<"此ID已存在,请重新输入"<<endl;
return;
}
t=t->next;
}
t->next=q;
}
else//头结点空
{
head_tea=q;//头结点被赋值q
}
Unit::isModified=1;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -