📄 studentbasicinformation.cpp
字号:
#include"publicHeadFile.h"
#include"studentBasicInformation.h"
void managerRegister(); //管理员注册模块函数的声名
int managerMenuControl(); //管理员菜单控制函数的声明
void managerOperatorMenu();
void managerOperatorMenuControl();
void managerOperatorMenu();
void managerOperatorMenuControl();
//static studentInformation *head;
void studentInformation::setStuBasicInformation()//向文件中写入学生基本信息
{
// char s_number1[16];
char s_number2[16],s_number3[16];
/* char s_name1[20];//s_name2[20];
char s_sex1[4];//s_sex2[4];
char s_gread1[10];//s_gread2[10];
char s_class1[10];//s_class2[10];
char s_minzhu1[10];//s_minzhu2[10];
char s_jiguan1[20];//s_jiguan2[20];
char s_birthday1[30];//s_birthday2[30];
char s_zhengzhimianmao1[10];//s_zhengzhimianmao2[10];
char s_qinshilou_number1[10];//s_qinshilou_number2[10];
char s_qinshi_number1[10];//s_qinshi_number2[10];
char s_qinshi_phoneNumber1[30];//s_qinshi_phoneNumber2[30];
char s_lianxi_phone1[30];//s_lianxi_phone2[30];
char s_lianxi_address1[100];//s_lianxi_address2[100];*/
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;
ofstream SaveFile1("studentBasicInformation.txt");
ofstream SaveFile2("studentNumberTable.txt");
/*
cout<<"\n\n\t\t\t学号: ";
cin>>s_number1;
SaveFile1<<"学 号: "<< s_number1<<"\n";//在文件中保存学号
SaveFile2<< s_number1;
cout<<"\n\t\t\t姓名: ";
cin>>s_name1;
SaveFile1<<"姓 名: "<<s_name1<<"\n";//在文件中保存姓名
cout<<"\n\t\t\t性别: ";
cin>>s_sex1;
SaveFile1<<"性 别: "<<s_sex1<<"\n";//在文件中保存性别
cout<<"\n\t\t\t年级: ";
cin>>s_gread1;
SaveFile1<<"年 级: "<<s_gread1<<"\n";//在文件中保存年级
cout<<"\n\t\t\t班级: ";
cin>>s_class1;
SaveFile1<<"班 级: "<<s_class1<<"\n";//在文件中保存班级
cout<<"\n\t\t\t民族: ";
cin>>s_minzhu1;
SaveFile1<<"民 族: "<<s_minzhu1<<"\n";//在文件中保存民族
cout<<"\n\t\t\t籍贯: ";
cin>>s_jiguan1;
SaveFile1<<"籍 贯: "<<s_jiguan1<<"\n";//在文件中保存籍贯
cout<<"\n\t\t\t生日: ";
cin>>s_birthday1;
SaveFile1<<"生 日: "<<s_birthday1<<"\n";//在文件中保存生日
cout<<"\n\t\t\t政治面貌: ";
cin>>s_zhengzhimianmao1;
SaveFile1<<"政治面貌: "<<s_zhengzhimianmao1<<"\n";//在文件中保存政治面貌
cout<<"\n\t\t\t寝室楼号: ";
cin>>s_qinshilou_number1;
SaveFile1<<"寝室楼号: "<<s_qinshilou_number1<<"\n";//在文件中保存寝室楼号
cout<<"\n\t\t\t寝室号: ";
cin>>s_qinshi_number1;
SaveFile1<<"寝 室 号: "<<s_qinshi_number1<<"\n";//在文件中保存寝室号
cout<<"\n\t\t\t寝室电话: ";
cin>>s_qinshi_phoneNumber1;
SaveFile1<<"寝室电话: "<<s_qinshi_phoneNumber1<<"\n";//在文件中保存寝室电话
cout<<"\n\t\t\t个人电话: ";
cin>>s_lianxi_phone1;
SaveFile1<<"个人电话: "<<s_lianxi_phone1<<"\n";//在文件中保存个人电话
cout<<"\n\t\t\t联系地址: ";
cin>>s_lianxi_address1;
SaveFile1<<"联系地址: "<<s_lianxi_address1<<"\n";//在文件中保存联系地址
*/
ofstream SaveFile3,SaveFile4;
SaveFile3.close();
SaveFile4.close();
}
cout<<"\n\n\t\t\t信息编辑成功!"<<endl;
cout<<"\n\n\t\t\t是否继续编辑? 继续(y键)/返回(n键)"<<endl;
if(0)
{
system("cls");
}
else
{
system("cls");
cout<<"\n\t\t\t请按任意键返回上级菜单。"<<endl;
getch();
system("cls");
managerOperatorMenu();
managerOperatorMenuControl();
}
}
void studentInformation::disMessage()
{
ifstream infile("学生基本信息.txt");
if(!infile)
{
cout<<"你不能打开这个文件"<<endl;
}
char ch;
while(infile)
{
infile.get(ch);
cout<<ch;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -