赞
踩
cout << “查找学生学号:” << pfind->ru_num << " 姓名: " << pfind->ru_nam << " 班级: " << pfind->ru_cla << " 缴费金额: " << pfind->ru_mon << " 入住时间: " << pfind->ru_check_in << “退房时间:” << pfind->ru_check_out << endl;
break;
case 5:
ru.RuShow();
break;
case 6:
ru.RuQuit();
break;
}
}
}
#include"Fuzhu.h"
#define MAX_NUM 10000000
#include
#include
#include<windows.h>
#include
#include
#include
#define random(a,b) (rand()%(b-a+1)+a)
using namespace std;
void suijishu(int a,int b)
{
srand((unsigned)time(NULL));
for (int i = 0; i<10; i++)
cout << random(a, b) << " ";
}
/*void pdwei(int ru_num)
{
while (ru_num<10000 || ru_num>99999)
{
cout << “你输入的学号不正确,请输入一个五位数的学号” << endl;
cout << “学号:”;
cin >> ru_num;
}
}*/
int Systemdoor()
{
string username = “hello”, password = “nihao”;
string name, temp;
int number = 3;
while (1)
{
time_t t;
time(&t);
cout << “---------------------------------欢迎使用学生宿舍管理信息系统-------------------------------” << endl;
cout << “********************************************************************************************” << endl << endl;
cout << “\t\t 本地时间:” << ctime(&t);
cout << " 用 户 名:";
cin >> name;
cout << " 密 码:";
cin >> temp;
cout << endl;
if (name != username || temp != password)
{
number–;
if (number >0)
{
cout << " 用户名/密码错误!你还有" << number << “次机会” << endl;
}
else
cout << “用户名/密码错误!” << endl, exit(0);
}
else
{
cout << “密码正确” << endl << endl;
for (int i = 0; i ❤️; i++)
{
Sleep(1000); /* windows 使用Sleep,参数为毫秒 */
}
system(“cls”); //清屏
return 1;
}
}
}
#include"Weisheng.h"
#define MAX_NUM 10000000
#include
#include
#include
using namespace std;
struct WeiNode{
char wei_score[40];
int wei_n=0;
char wei_sus[40];
WeiNode *nextwei;
};
class Weisheng{
WeiNode *WeiListHead;
public:
Weisheng(); //构造函数
~Weisheng(); //析构函数
void WeiCreat(); //创建信息
void WeiInsert(int n, char* sus, char* score); //插入入住信息
WeiNode WeiFind(char sus); //查找入住信息,传入参数宿舍号
void WeiSort(char ch); //根据 总分排序
void WeiCopy(WeiNode *ptemp, WeiNode *p);
void WeiRead(); //从文件读入信息
void WeiSave(); //保存学信息到文件
void WeiQuit();
void WeiShow(); //遍历输出信息
void panduan(int ru_num);
void Weiin();
};
void WeiMenu()
{
time_t t;
time(&t);
cout << “---------------------------------学生宿舍卫生评比模块-------------------------------” << endl;
cout << “\t\t\t 本地时间:” << ctime(&t);
cout << “--------------------------------------------------------------------------------\n” << endl;
cout << "\t\t 1.读入宿舍卫生信息 " << endl;
cout << "\t\t 2.录入宿舍卫生表格 " << endl;
cout << "\t\t 3.查找宿舍卫生信息 " << endl;
cout << "\t\t 4.输出所有宿舍信息 " << endl;
cout << "\t\t 5.保存现有宿舍信息 " << endl;
cout << "\t\t 0.返回主菜单 " << endl;
cout << “\n\t\t请选择:”;
}
Weisheng::Weisheng() //构造函数
{
WeiListHead = new WeiNode;
WeiListHead->nextwei = NULL;
}
Weisheng::~Weisheng() //析构函数
{
WeiNode *p;
while (WeiListHead)
{
p = WeiListHead;
WeiListHead = WeiListHead->nextwei;
delete p;
}
WeiListHead = NULL;
}
void Weisheng::WeiInsert(int n, char* sus, char* score) //插入入住信息(头插法)
{
WeiNode *s, *p;
s = new WeiNode;
s->wei_n = n;
strcpy(s->wei_sus, sus);
strcpy(s->wei_score, score);
p = WeiListHead;
s->nextwei = p->nextwei;
p->nextwei = s;
}
void Weisheng::WeiRead() //从文件读入数据
{
WeiNode *p;
p = WeiListHead;
ifstream in(“weishenga.txt”);
if (!in) { cout << “文件weishenga.txt中没有宿舍信息,请先录入宿舍信息!” << endl; return; }
while (!in.eof())
{
int n; char sus[40]; char score[40];
in >> n >> sus >> score;
WeiInsert(n, sus, score);
}
}
void Weisheng::WeiCreat() //创建宿舍卫生信息表
{
int n;
WeiNode *p, *s;
p = WeiListHead;
cout << “请输入学生宿舍卫生条数:”;
cin >> n;
for (int i = 1; i <= n; i++)
{
s = new WeiNode;
cout << “宿舍号:”; cin >> s->wei_sus;
//panduan(s->wei_num);
cout << “卫生评分:”; cin >> s->wei_score;
cout << “排名:”; cin >> s->wei_n;
s->nextwei = p->nextwei;
p->nextwei = s;
p = p->nextwei;
}
if (p == NULL) //判断信息表是否创建成功
{
cout << “创建失败请重新创建!” << endl;
WeiCreat();
}
}
void Weisheng::WeiShow() //遍历输出
{
WeiNode *p;
cout << “排名” << ‘\t’ << “宿舍” << ‘\t’ << “评分” << endl;
for (p = WeiListHead->nextwei; p != NULL; p = p->nextwei)
{
cout << p->wei_n << ‘\t’ << p->wei_sus << ‘\t’ << p->wei_score << endl;
}
}
void Weisheng::Weiin()
{
WeiNode *p;
int i = 1;
for (p = WeiListHead->nextwei; p != NULL; p = p->nextwei)
{
p->wei_n = i;
i++;
}
}
WeiNode Weisheng::WeiFind(char sus)
{
WeiNode *p;
p = WeiListHead->nextwei;
while (p->nextwei && strcmp(p->wei_sus ,sus)!=0) //循环终止条件为p->nextru不为空 而且没有找到相应宿舍
{
p = p->nextwei;
}
if (strcmp(p->wei_sus,sus)==0)
{
return p;
}
else
{
cout << “未找到该宿舍信息!” << endl;
return NULL;
}
}
void Weisheng::WeiCopy(WeiNode *ptemp, WeiNode *p) //拷贝信息(将p的信息拷贝到ptemp中)
{
if (p == NULL)
{
cout << “拷贝目标为空!” << endl;
}
else
{
ptemp->wei_n = p->wei_n;
strcpy(ptemp->wei_sus,p->wei_sus);
strcpy(ptemp->wei_score, p->wei_score);
//ptemp->nextwei = p->nextwei; //只是信息拷贝,next不能拷贝否则信息丢失
}
}
void Weisheng::WeiSort(char ch) //根据 总分排序
{
if (ch == ‘>’)
{
for (WeiNode *p = WeiListHead->nextwei; p != NULL; p = p->nextwei)
{
for (WeiNode *q = WeiListHead->nextwei; q != NULL; q = q->nextwei)
{
if (strcmp(p->wei_score ,q->wei_score)>0)
{
WeiNode *ptemp = new WeiNode;
WeiCopy(ptemp, p);
WeiCopy(p, q);
WeiCopy(q, ptemp);
}
}
}
}
else if (ch == ‘<’)
{
for (WeiNode *p = WeiListHead->nextwei; p != NULL; p = p->nextwei)
{
for (WeiNode *q = WeiListHead->nextwei; q != NULL; q = q->nextwei)
{
if (strcmp(p->wei_score, q->wei_score)<0)
{
WeiNode *ptemp = new WeiNode;
WeiCopy(ptemp, p);
WeiCopy(p, q);
WeiCopy(q, ptemp);
}
}
}
}
else
{
cout << “排序条件出错!” << endl;
}
}
void Weisheng::WeiSave() //保存信息
{
WeiNode *p;
p = WeiListHead->nextwei;
ofstream out(“weishenga.txt”);
if (!out) { cout << “不能打开文件weishenga.txt!” << endl; return; }
while (p != NULL)
{
out << p->wei_n << ‘\t’ << p->wei_sus << ‘\t’ << p->wei_score << ‘\n’;
p = p->nextwei;
}
}
void Weisheng::WeiQuit() //信息写入文件
{
char choice;
cout << “是否保存宿舍卫生信息:?(Y/N)”;
cin >> choice;
if (choice == ‘y’ || choice == ‘Y’)
{
WeiSave();
cout << “宿舍卫生信息已保存…” << endl;
}
}
void weisheng()
{
char psus[40];
WeiNode *pfind;
Weisheng wei;
while (1)
{
system(“pause”);
system(“cls”); //清屏
WeiMenu();
int x;
cin >> x;
if (x == 0){
return;
}
switch (x)
{
case 1:
wei.WeiRead();
cout << “读入宿舍卫生评分信息表:” << endl;
wei.WeiShow();
break;
case 2:
wei.WeiCreat();
cout << “请核对输入评分信息!” << endl;
wei.WeiShow();
break;
case 3:
cout << “请输入要查找宿舍:”;
cin >> psus;
pfind = wei.WeiFind(psus);
cout << “查找宿舍卫生情况:” << endl;
cout<<“宿舍排名:”<wei_n << " 宿舍号: " << pfind->wei_sus << " 评分: " << pfind->wei_score << endl;
break;
case 4:
cout << “宿舍卫生排名升序排序请按1!倒序排序请按2!” << endl;
int p;
cin >> p;
if (p == 1)
{
wei.WeiSort(‘<’);
wei.Weiin();
wei.WeiShow();
}
else if (p == 2)
{
wei.WeiSort(‘>’);
wei.WeiShow();
}
else
{
cout << “输入指令错误!” << endl;
}
break;
case 5:
wei.WeiQuit();
break;
}
}
}
#include"Shoufei.h"
#define MAX_NUM 10000000
#include <windows.h>
#include
#include
#include
using namespace std;
struct ShouNode{
int shou_du = 0;
int shou_fei;
char shou_sus[40];
ShouNode *nextshou;
};
class Shoufei{
ShouNode *ShouListHead;
public:
Shoufei(); //构造函数
~Shoufei(); //析构函数
void ShouCreat(); //创建宿舍收费表信息
void ShouInsert(char* sus, int du,int fei); //插入宿舍收费信息信息
ShouNode ShouFind(char sus); //查找信息,传入参数学号
void ShouRead(); //从文件读入宿舍收费信息
void ShouSave(); //保存信息到文件
void ShouQuit();
void ShouShow(); //遍历输出宿舍收费信息
};
void ShouMenu()
{
time_t t;
time(&t);
cout << “---------------------------------宿舍水电费模块-------------------------------” << endl;
cout << “\t\t\t 本地时间:” << ctime(&t);
cout << “--------------------------------------------------------------------------------\n” << endl;
cout << "\t\t 1.读入宿舍水电信息 " << endl;
cout << "\t\t 2.录入宿舍水电表格 " << endl;
cout << "\t\t 3.查找已有宿舍信息 " << endl;
cout << "\t\t 4.输出所有收费信息 " << endl;
cout << "\t\t 5.保存宿舍收费信息 " << endl;
cout << "\t\t 0.返回主菜单 " << endl;
cout << “\n\t\n\t\t请选择:”;
}
Shoufei::Shoufei() //构造函数
{
ShouListHead = new ShouNode;
ShouListHead->nextshou = NULL;
}
Shoufei::~Shoufei() //析构函数
{
ShouNode *p;
while (ShouListHead)
{
p = ShouListHead;
ShouListHead = ShouListHead->nextshou;
delete p;
}
ShouListHead = NULL;
}
void Shoufei::ShouRead() //从文件读入数据
{
ShouNode *p;
p = ShouListHead;
ifstream in(“shoufeia.txt”);
if (!in) { cout << “文件shoufeia.txt中没有入住信息,请先录入入住信息!” << endl; return; }
while (!in.eof())
{
int du,fei; char sus[40];
in >> sus >> du >> fei;
ShouInsert(sus,du,fei);
}
}
int standard(int du){
int fei=100;
if (du > 200)
return (100 + (du - 200) * 3);
else
return fei;
}
void Shoufei::ShouCreat() //创建信息表
{
int n;
ShouNode *p, *s;
p = ShouListHead;
cout << “请输入录入宿舍条数:”;
cin >> n;
for (int i = 1; i <= n; i++)
{
s = new ShouNode;
cout << “宿舍:”; cin >> s->shou_sus;
cout << “水电使用度:”; cin >> s->shou_du;
s->shou_fei = standard(s->shou_du);
s->nextshou = p->nextshou;
p->nextshou = s;
p = p->nextshou;
}
if (p == NULL) //判断信息表是否创建成功
{
cout << “创建失败请重新创建!” << endl;
ShouCreat();
}
}
void Shoufei::ShouInsert(char* sus, int du, int fei) //插入宿舍收费信息(头插法)
{
ShouNode *s, *p;
s = new ShouNode;
s->shou_du = du;
s->shou_fei = fei;
strcpy(s->shou_sus, sus);
p = ShouListHead;
s->nextshou = p->nextshou;
p->nextshou = s;
}
ShouNode Shoufei::ShouFind(char sus)
{
ShouNode *p;
p = ShouListHead->nextshou;
while (p->nextshou && strcmp(p->shou_sus, sus) != 0) //循环终止条件为p->nextru不为空 而且没有找到宿舍
{
p = p->nextshou;
}
if (strcmp(p->shou_sus, sus) == 0)
{
return p;
}
else
{
cout << “未找到该宿舍信息!” << endl;
return NULL;
}
}
void Shoufei::ShouShow() //遍历输出
{
ShouNode *p;
HANDLE handle;
handle = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY | FOREGROUND_RED);//设置控制台字体颜色为红色
//printf(“这是红色\n”);
cout << “提示!规定水电量在200度,收费100元,若超出则按超出部分每平方3元收费” << endl;
//SetConsoleTextAttribute(handle, FOREGROUND_INTENSITY);//灰色
SetConsoleTextAttribute(handle, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);//恢复默认的灰色
//printf(“这是灰色\n”);
cout << “宿舍” << ‘\t’ << “水电度数” << ‘\t’ << “水电费用” << endl;
for (p = ShouListHead->nextshou; p != NULL; p = p->nextshou)
{
cout << p->shou_sus << ‘\t’<<" " << p->shou_du << ‘\t’ << p->shou_fei<< endl;
}
}
void Shoufei::ShouSave() //保存信息
{
ShouNode *p;
p = ShouListHead->nextshou;
ofstream out(“shoufeia.txt”);
if (!out) { cout << “不能打开文件shoufeia.txt!” << endl; return; }
while (p != NULL)
{
out << p->shou_sus << ‘\t’ << p->shou_du << ‘\t’ << p->shou_fei << endl;
p = p->nextshou;
}
}
void Shoufei::ShouQuit() //信息写入文件
{
char choice;
cout << “是否保存宿舍水电费收费信息:?(Y/N)”;
cin >> choice;
if (choice == ‘y’ || choice == ‘Y’)
{
ShouSave();
cout << “宿舍水电收费信息已保存…” << endl;
}
}
void shoufei()
{
char psus[40];
ShouNode *pfind;
Shoufei sf;
while (1)
{
system(“pause”);
system(“cls”); //清屏
ShouMenu();
int x;
cin >> x;
if (x == 0){
return;
}
switch (x)
{
case 1:
sf.ShouRead();
cout << “读入宿舍收费表:” << endl;
sf.ShouShow();
break;
case 2:
sf.ShouCreat();
cout << “请核对输入宿舍收费信息!” << endl<<endl;
sf.ShouShow();
break;
case 3:
cout << “请输入要查找宿舍:”;
cin >> psus;
pfind = sf.ShouFind(psus);
cout << “要查找的宿舍:” << pfind->shou_sus << " 水电度数: " << pfind->shou_du << " 水电收费: " << pfind->shou_fei << endl;
break;
case 4:
sf.ShouShow();
break;
case 5:
sf.ShouQuit();
break;
}
}
}
#include"baoxiu.h"
#define MAX_NUM 10000000
#include
#include
#include
using namespace std;
struct BaoNode{
char bao_sus[40];
char bao_pro[40];
char bao_tim[40];
char bao_zhu[40];
BaoNode *nextbao;
};
class Baoxiu{
BaoNode *BaoListHead;
public:
Baoxiu(); //构造函数
~Baoxiu(); //析构函数
void BaoCreat(); //创建信息
void BaoInsert(char* sus, char* pro, char* tim, char* zhu); //插入信息
BaoNode *BaoFind(char *sus); //查找信息,传入参数学号
void BaoRead(); //从文件读入信息
void BaoSave(); //保存信息到文件
void BaoQuit();
void BaoShow(); //遍历输出信息
};
void BaoMenu()
{
time_t t;
time(&t);
cout << “---------------------------------宿舍房屋报修模块-------------------------------” << endl;
cout << “\t\t\t 本地时间:” << ctime(&t);
cout << “--------------------------------------------------------------------------------\n” << endl;
cout << "\t\t 1.读入宿舍报修信息 " << endl;
cout << "\t\t 2.录入宿舍报修信息 " << endl;
cout << "\t\t 3.查找已有宿舍信息 " << endl;
cout << "\t\t 4.输出所有宿舍信息 " << endl;
cout << "\t\t 5.保存宿舍报修信息 " << endl;
cout << "\t\t 0.返回信息主菜单 " << endl;
cout << “\n\t\t请选择:”;
}
Baoxiu::Baoxiu() //构造函数
{
BaoListHead = new BaoNode;
BaoListHead->nextbao = NULL;
}
Baoxiu::~Baoxiu() //析构函数
{
BaoNode *p;
while (BaoListHead)
{
p = BaoListHead;
BaoListHead = BaoListHead->nextbao;
delete p;
}
BaoListHead = NULL;
}
void Baoxiu::BaoCreat() //创建学生信息表
{
int n;
BaoNode *p, *s;
p = BaoListHead;
cout << “请输入录入宿舍条数:”;
cin >> n;
for (int i = 1; i <= n; i++)
{
s = new BaoNode;
cout << “宿舍:”; cin >> s->bao_sus;
cout << “报修项目:”; cin >> s->bao_pro;
cout << “预约时间:”; cin >> s->bao_tim;
cout << “维修状态:”; cin >> s->bao_zhu;
s->nextbao = p->nextbao;
p->nextbao = s;
p = p->nextbao;
}
if (p == NULL) //判断维修表是否创建成功
{
cout << “创建失败请重新创建!” << endl;
BaoCreat();
}
}
void Baoxiu::BaoShow() //遍历输出
{
BaoNode *p;
cout << “宿舍” << ‘\t’ << “报修项目” << ‘\t’ << “预约时间” << ‘\t’ << “维修状态” << endl;
for (p = BaoListHead->nextbao; p != NULL; p = p->nextbao)
{
cout << p->bao_sus << ‘\t’ << p->bao_pro << ‘\t’ << p->bao_tim << ‘\t’ << p->bao_zhu << endl;
}
}
void Baoxiu::BaoInsert(char* sus, char* pro, char* tim, char* zhu) //插入信息(头插法)
{
BaoNode *s, *p;
s = new BaoNode;
strcpy(s->bao_sus, sus);
strcpy(s->bao_pro, pro);
strcpy(s->bao_tim, tim);
strcpy(s->bao_zhu, zhu);
p = BaoListHead;
s->nextbao = p->nextbao;
p->nextbao = s;
}
BaoNode Baoxiu::BaoFind(char sus)
{
BaoNode *p;
p = BaoListHead->nextbao;
while (p->nextbao && strcmp(p->bao_sus, sus) != 0) //循环终止条件为p->nextru不为空 而且没有找到宿舍
{
p = p->nextbao;
}
if (strcmp(p->bao_sus, sus) == 0)
{
return p;
}
else
{
cout << “未找到该宿舍维修信息!” << endl;
return NULL;
}
}
void Baoxiu::BaoRead() //从文件读入数据
{
BaoNode *p;
p = BaoListHead;
ifstream in(“baoxiua.txt”);
if (!in) { cout << “文件baoxiua.txt中没有报修信息,请先录入报修信息!” << endl; return; }
while (!in.eof())
{
char sus[40]; char pro[40]; char tim[40]; char zhu[40];
in >> sus >> pro >> tim >> zhu;
BaoInsert(sus, pro, tim, zhu);
}
}
void Baoxiu::BaoSave() //保存信息
{
BaoNode *p;
p = BaoListHead->nextbao;
ofstream out(“baoxiua.txt”);
if (!out) { cout << “不能打开文件baoxiua.txt!” << endl; return; }
while (p != NULL)
{
out << p->bao_sus << ‘\t’ << p->bao_pro << ‘\t’ << p->bao_tim << ‘\t’ << p->bao_zhu << endl;
p = p->nextbao;
}
}
void Baoxiu::BaoQuit() //信息写入文件
{
char choice;
cout << “是否保存报修信息:?(Y/N)”;
cin >> choice;
if (choice == ‘y’ || choice == ‘Y’)
{
BaoSave();
cout << “报修信息已保存…” << endl;
}
}
void baoxiu()
{
char psus[40];
BaoNode *pfind;
Baoxiu bx;
while (1)
{
system(“pause”);
system(“cls”);
BaoMenu();
int x;
cin >> x;
if (x == 0){
return;
}
switch (x)
{
case 1:
bx.BaoRead();
cout << “读入宿舍报修表:” << endl;
bx.BaoShow();
break;
case 2:
bx.BaoCreat();
cout << “请核对输入宿舍报修信息!” << endl << endl;
bx.BaoShow();
break;
case 3:
cout << “请输入要查找宿舍:”;
cin >> psus;
pfind = bx.BaoFind(psus);
cout << "要查找的宿舍:" << pfind->bao_sus << " 报修项目:" << pfind->bao_pro << " 预约时间:" << pfind->bao_tim<<" 维修状态:"<<pfind->bao_zhu<< endl;
break;
case 4:
bx.BaoShow();
break;
case 5:
bx.BaoQuit();
break;
}
}
}
#include"Dengji.h"
#define MAX_NUM 10000000
#include
#include
#include
using namespace std;
struct DenNode{
char den_nam[40];
char den_tel[40];
char den_op[40];
char den_intime[40];
char den_outtime[40];
DenNode *nextden;
};
class Dengji{
DenNode *DenListHead;
public:
Dengji(); //构造函数
~Dengji(); //析构函数
void DenInsert(char* nam,char* op,char* tel,char* intime,char* outtime); //插入信息
DenNode *DenFind(char *nam); //查找信息,传入参数学号
void DenRead(); //从文件读入信息
void DenSave(); //保存信息到文件
void DenQuit();
void DenShow(); //遍历输出信息
};
void DenMenu()
{
time_t t;
time(&t);
cout << “---------------------------------宿舍房屋报修模块-------------------------------” << endl;
cout << “\t\t\t 本地时间:” << ctime(&t);
cout << “--------------------------------------------------------------------------------\n” << endl;
cout << "\t\t 1.读入人员登记信息 " << endl;
cout << "\t\t 2.进入登记信息 " << endl;
cout << "\t\t 3.离开登记信息 " << endl;
cout << "\t\t 4.查找外来登记信息 " << endl;
cout << "\t\t 5.输出所有登记信息 " << endl;
cout << "\t\t 6.保存登记信息 " << endl;
cout << "\t\t 0.返回信息主菜单 " << endl;
cout << “\n\t\t请选择:”;
}
Dengji::Dengji() //构造函数
{
DenListHead = new DenNode;
DenListHead->nextden = NULL;
}
Dengji::~Dengji() //析构函数
{
DenNode *p;
while (DenListHead)
{
p = DenListHead;
DenListHead = DenListHead->nextden;
delete p;
}
DenListHead = NULL;
}
void Dengji::DenShow() //遍历输出
{
DenNode *p;
cout << “来访人姓名” << ‘\t’ << “来访理由” << ‘\t’ << “联系方式” << ‘\t’ << “来访时间”<<‘\t’<<“离开时间” << endl;
for (p = DenListHead->nextden; p != NULL; p = p->nextden)
{
cout << p->den_nam << ‘\t’ << p->den_op << ‘\t’ << p->den_tel << ‘\t’ << p->den_intime<<‘\t’<den_outtime << endl;
}
}
void Dengji::DenInsert(char* nam, char* op, char* tel,char* intime,char* outtime) //插入信息(头插法)
{
DenNode *s, *p;
s = new DenNode;
strcpy(s->den_nam, nam);
strcpy(s->den_op, op);
strcpy(s->den_tel, tel);
strcpy(s->den_intime, intime);
strcpy(s->den_outtime, outtime);
p = DenListHead;
s->nextden = p->nextden;
p->nextden = s;
}
DenNode Dengji::DenFind(char nam)
{
DenNode *p;
p = DenListHead->nextden;
while (p->nextden && strcmp(p->den_nam, nam) != 0) //循环终止条件为p->nextru不为空 而且没有找到宿舍
{
p = p->nextden;
}
if (strcmp(p->den_nam, nam) == 0)
{
return p;
}
else
{
cout << “未找到外来登记信息!” << endl;
return NULL;
}
}
void Dengji::DenRead() //从文件读入数据
{
DenNode *p;
p = DenListHead;
ifstream in(“dengjia.txt”);
if (!in) { cout << “文件dengjia.txt中没有报修信息,请先录入报修信息!” << endl; return; }
while (!in.eof())
{
char nam[40]; char op[40]; char tel[40]; char intime[40]; char outtime[40];
in >> nam >> op >> tel >> intime >> outtime;
DenInsert(nam, op, tel,intime,outtime);
}
}
void Dengji::DenSave() //保存信息
{
DenNode *p;
p = DenListHead->nextden;
ofstream out(“dengjia.txt”);
if (!out) { cout << “不能打开文件dengjia.txt!” << endl; return; }
while (p != NULL)
{
out << p->den_nam << ‘\t’ << p->den_op << ‘\t’ << p->den_tel << ‘\t’ << p->den_intime << ‘\t’ << p->den_outtime << endl;
p = p->nextden;
}
}
void Dengji::DenQuit() //信息写入文件
{
char choice;
cout << “是否保存登记信息:?(Y/N)”;
cin >> choice;
if (choice == ‘y’ || choice == ‘Y’)
{
DenSave();
cout << “登记信息已保存…” << endl;
}
}
void dengji()
{
char nam[40], op[40], tel[40], intime[40];
char outtime[40]=“未离开”;
DenNode *pfind;
Dengji dj;
while (1)
{
system(“pause”);
system(“cls”);
DenMenu();
int x;
cin >> x;
if (x == 0){
return;
}
switch (x)
{
case 1:
dj.DenRead();
cout << “读入宿舍外来人员登记表:” << endl;
dj.DenShow();
break;
case 2:
time_t a;
time(&a);
cout << “来访人姓名:”; cin >> nam;
cout << “来访理由:”; cin >> op;
cout << “联系方式:”; cin >> tel;
strcpy(intime, ctime(&a));
dj.DenInsert(nam, op, tel, intime, outtime);
cout << “请核对输入外来人员登记信息!” <<endl;
dj.DenShow();
break;
case 3:
time_t b;
time(&b);
cout << “来访人姓名:”; cin >> nam;
pfind = dj.DenFind(nam);
strcpy(pfind->den_outtime, ctime(&b));
cout << “离开时间已登记!” << ctime(&b) << endl;
break;
case 4:
cout << “请输入要查找来访人姓名:”;
cin >> nam;
pfind = dj.DenFind(nam);
cout << “要查找的人员:” << pfind->den_nam << " 来访理由:" << pfind->den_op << " 联系方式:" << pfind->den_tel << " 来访时间:" << pfind->den_intime<<" 离开时间:" <den_outtime<< endl;
break;
case 5:
dj.DenShow();
break;
case 6:
dj.DenQuit();
break;
}
}
}
#include"Chaqin.h"
#define MAX_NUM 10000000
#include
#include
#include
using namespace std;
void chaqin()
{
int n;
cout << “请输入楼层数:”; cin >> n;
for (int i = 1; i <= n; i++){
int a, b;
cout << “请输入” << i << “楼层查寝宿舍区间:”;
cin >> a >> b;
cout << i << “楼查寝宿舍” << endl;
suijishu(a, b);
cout << endl << endl;
}
}
### 2、**主函数:**
#include
#include<windows.h>
#include “Sushe.h”
#include “Ruzhu.h”
#include"Fuzhu.h"
#include"Weisheng.h"
#include"Shoufei.h"
#include"baoxiu.h"
#include"Dengji.h"
#include"Chaqin.h"
#include
using namespace std;
int main()
{
Systemdoor();
cout << " ********************************************************************************************************************" << endl;
cout << " ********************************************************************************************************************" << endl;
cout << " ********************************************************************************************************************" << endl;
cout << " ********************************************************************************************************************" << endl;
cout << " ******************* *******************" << endl;
cout << " ******************* *******************" << endl;
cout << " ******************* 欢迎进入学生宿舍管理信息管理系统 *******************" << endl;
cout << " ******************* ******************" << endl;
cout << " ******************* *******************" << endl;
cout << " ********************************************************************************************************************" << endl;
cout << " ********************************************************************************************************************" << endl;
cout << " ********************************************************************************************************************" << endl;
cout << " ********************************************************************************************************************" << endl;
while(1){
system(“pause”);
开源分享:【大厂前端面试题解析+核心总结学习笔记+真实项目实战+最新讲解视频】
#include"baoxiu.h"
#include"Dengji.h"
#include"Chaqin.h"
#include
using namespace std;
int main()
{
Systemdoor();
cout << " ********************************************************************************************************************" << endl;
cout << " ********************************************************************************************************************" << endl;
cout << " ********************************************************************************************************************" << endl;
cout << " ********************************************************************************************************************" << endl;
cout << " ******************* *******************" << endl;
cout << " ******************* *******************" << endl;
cout << " ******************* 欢迎进入学生宿舍管理信息管理系统 *******************" << endl;
cout << " ******************* ******************" << endl;
cout << " ******************* *******************" << endl;
cout << " ********************************************************************************************************************" << endl;
cout << " ********************************************************************************************************************" << endl;
cout << " ********************************************************************************************************************" << endl;
cout << " ********************************************************************************************************************" << endl;
while(1){
system(“pause”);
开源分享:【大厂前端面试题解析+核心总结学习笔记+真实项目实战+最新讲解视频】
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。