}
}
void Sushe::StuSave() //保存学生信息
{
StuNode *p;
p = StuListHead->nextstu;
ofstream out(“sushea.txt”);
if (!out) { cout << “不能打开文件sushea.txt!” << endl; return; }
while (p != NULL)
{
out << p->stu_num << ‘\t’ << p->stu_nam << ‘\t’ << p->stu_cla << ‘\t’ << p->stu_sus << ‘\t’ << p->stu_chu << ‘\n’;
p = p->nextstu;
}
}
void Sushe::StuQuit() //学生信息写入文件
{
char choice;
cout << “是否保存学生信息:?(Y/N)”;
cin >> choice;
if (choice == ‘y’ || choice == ‘Y’)
{
StuSave();
cout << “学生信息已保存…” << endl;
}
}
void sushe()
{
system(“mode con:cols=200 lines=1000”);
int pnum;
char pnam[40]; char pcla[40]; char psus[40]; char pchu[40];
StuNode *pfind;
Sushe stu;
while (1)
{
system(“pause”);
system(“cls”); //清屏
SuMenu();
int x;
cin >> x;
if (x == 0){
return;
}
switch (x)
{
case 1:
stu.StuRead();
cout << “读入学生宿舍信息表:” << endl;
stu.ShowInfo();
break;
case 2:
stu.CreatSinfo();
cout << “请核对输入学生信息!” << endl;
stu.ShowInfo();
break;
case 3: //添加信息
cout << “请输入添加学生宿舍信息:” << endl;
cout << “学号:”; cin >> pnum;
stu.panduan(pnum);
cout << “姓名:”; cin >> pnam;
cout << “班级:”; cin >> pcla;
cout << “宿舍:”; cin >> psus;
cout << “床号:”; cin >> pchu;
stu.StuInsert(pnum, pnam, pcla, psus, pchu);
cout << “更新学生宿舍信息表…” << endl;
stu.ShowInfo();
break;
case 4:
cout << “请输入要删除学生学号:”;
cin >> pnum;
stu.StuDelete(pnum);
cout << “更新学生宿舍信息表…” << endl;
stu.ShowInfo();
break;
case 5:
cout << “请输入要查找学生学号:”;
cin >> pnum;
pfind = stu.StuFind(pnum);
cout << “查找学生学号:” << pfind->stu_num << " 姓名: " << pfind->stu_nam << " 班级: " << pfind->stu_cla << " 宿舍: " << pfind->stu_sus << " 床号: " << pfind->stu_chu << endl;
break;
case 6:
cout << “请输入要修改学生学号:”;
cin >> pnum;
cout << “请重新输入学生宿舍信息!”<<endl;
cout << “姓名:”; cin >> pnam;
cout << “班级:”; cin >> pcla;
cout << “宿舍:”; cin >> psus;
cout << “床号:”; cin >> pchu;
stu.StuModify(pnum, pnam, pcla, psus, pchu);
cout << “更新学生宿舍信息表…” << endl;
stu.ShowInfo();
break;
case 9:
stu.ShowInfo();
break;
case 10:
stu.StuQuit();
break;
}
}
}
#include “Ruzhu.h”
#define MAX_NUM 10000000
#include
#include
#include
using namespace std;
struct RuNode{
long ru_num = 0;
char ru_nam[40];
char ru_cla[40];
char ru_mon[40];
char ru_check_in[40];
char ru_check_out[40];
RuNode *nextru;
};
class Ruzhu{
RuNode *RuListHead;
public:
Ruzhu(); //构造函数
~Ruzhu(); //析构函数
void RuCreat(); //创建入住信息
void RuInsert(int num, char* nam, char* cla, char* mon, char* check_in,char* check_out); //插入入住信息
RuNode *RuFind(int num); //查找入住信息,传入参数学号
void RuRead(); //从文件读入入住信息
void RuSave(); //保存学生入住信息到文件
void RuQuit();
void RuShow(); //遍历输出学生入住信息
void panduan(int ru_num);
};
void pdweiru(int ru_num)
{
while (ru_num<10000 || ru_num>99999)
{
cout << “你输入的学号不正确,请输入一个五位数的学号” << endl;
cout << “学号:”;
cin >> ru_num;
}
}
void Ruzhu::panduan(int ru_num)
{
pdweiru(ru_num);
RuNode *p;
for (p = RuListHead->nextru; p != NULL; p = p->nextru)
{
while (p->ru_num == ru_num)
{
cout << “学号重复,请重新输入!” << endl;
cout << “学号:”;
cin >> ru_num;
}
}
}
void RuMenu()
{
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\n\t\t请选择:”;
}
Ruzhu::Ruzhu() //构造函数
{
RuListHead = new RuNode;
RuListHead->nextru = NULL;
RuListHead->ru_num = 0;
}
Ruzhu::~Ruzhu() //析构函数
{
RuNode *p;
while (RuListHead)
{
p = RuListHead;
RuListHead = RuListHead->nextru;
delete p;
}
RuListHead = NULL;
}
void Ruzhu::RuRead() //从文件读入数据
{
RuNode *p;
p = RuListHead;
ifstream in(“ruzhua.txt”);
if (!in) { cout << “文件ruzhua.txt中没有入住信息,请先录入入住信息!” << endl; return; }
while (!in.eof())
{
int num; char nam[40]; char cla[40]; char mon[40]; char check_in[40]; char check_out[40];
in >> num >> nam >> cla >> mon >> check_in >> check_out;
RuInsert(num, nam, cla, mon, check_in, check_out);
}
}
void Ruzhu::RuCreat() //创建学生信息表
{
int n;
RuNode *p, *s;
p = RuListHead;
cout << “请输入学生宿舍入住人数:”;
cin >> n;
for (int i = 1; i <= n; i++)
{
s = new RuNode;
cout << “学号:”; cin >> s->ru_num;
panduan(s->ru_num);
cout << “姓名:”; cin >> s->ru_nam;
cout << “班级:”; cin >> s->ru_cla;
cout << “缴费金额:”; cin >> s->ru_mon;
cout << “入住时间:”; cin >> s->ru_check_in;
cout << “退房时间:”; cin >> s->ru_check_out;
s->nextru = p->nextru;
p->nextru = s;
p = p->nextru;
}
if (p == NULL) //判断学生信息表是否创建成功
{
cout << “创建失败请重新创建!” << endl;
RuCreat();
}
}
void Ruzhu::RuInsert(int num, char* nam, char* cla, char* mon, char* check_in, char* check_out) //插入学生入住信息(头插法)
{
RuNode *s, *p;
s = new RuNode;
s->ru_num = num;
strcpy(s->ru_nam, nam);
strcpy(s->ru_cla, cla);
strcpy(s->ru_mon, mon);
strcpy(s->ru_check_in, check_in);
strcpy(s->ru_check_out, check_out);
p = RuListHead;
s->nextru = p->nextru;
p->nextru = s;
}
void Ruzhu::RuShow() //遍历输出
{
RuNode *p;
cout << “学号” << ‘\t’ << “姓名” << ‘\t’ << “班级” << ‘\t’ << “缴费金额” << ‘\t’ << “入住时间” << ‘\t’<<“退房时间”<<endl;
for (p = RuListHead->nextru; p != NULL; p = p->nextru)
{
cout << p->ru_num << ‘\t’ << p->ru_nam << ‘\t’ << p->ru_cla << ‘\t’ << p->ru_mon << ‘\t’ << p->ru_check_in<<‘\t’<ru_check_out << endl;
}
}
RuNode *Ruzhu::RuFind(int num)
{
RuNode *p;
p = RuListHead->nextru;
while (p->nextru && p->ru_num != num) //循环终止条件为p->nextru不为空 而且没有找到相应学号的学生
{
p = p->nextru;
}
if (p->ru_num == num)
{
return p;
}
else
{
cout << “未找到该学生信息!” << endl;
return NULL;
}
}
void Ruzhu::RuSave() //保存学生信息
{
RuNode *p;
p = RuListHead->nextru;
ofstream out(“ruzhua.txt”);
if (!out) { cout << “不能打开文件ruzhua.txt!” << endl; return; }
while (p != NULL)
{
out << p->ru_num << ‘\t’ << p->ru_nam << ‘\t’ << p->ru_cla << ‘\t’ << p->ru_mon << ‘\t’ << p->ru_check_in<<‘\t’<ru_check_out << ‘\n’;
p = p->nextru;
}
}
void Ruzhu::RuQuit() //学生信息写入文件
{
char choice;
cout << “是否保存学生入住信息:?(Y/N)”;
cin >> choice;
if (choice == ‘y’ || choice == ‘Y’)
{
RuSave();
cout << “学生入住信息已保存…” << endl;
}
}
void ruzhu()
{
int pnum;
char pnam[40]; char pcla[40]; char pmon[40]; char pcheck_in[40]; char pcheck_out[40];
RuNode *pfind;
Ruzhu ru;
while (1)
{
system(“pause”);
system(“cls”); //清屏
RuMenu();
int x;
cin >> x;
if (x == 0){
return;
}
switch (x)
{
case 1:
ru.RuRead();
cout << “读入学入住信息表:” << endl;
ru.RuShow();
break;
case 2:
ru.RuCreat();
cout << “请核对输入学生信息!” << endl;
ru.RuShow();
break;
case 3: //添加信息
cout << “请输入添加学生入住信息:” << endl;
cout << “学号:”; cin >> pnum;
ru.panduan(pnum);
cout << “姓名:”; cin >> pnam;
cout << “班级:”; cin >> pcla;
cout << “缴费金额:”; cin >> pmon;
cout << “入住时间:”; cin >> pcheck_in;
cout << “退房时间:”; cin >> pcheck_out;
ru.RuInsert(pnum, pnam, pcla, pmon, pcheck_in, pcheck_out);
cout << “更新学生入住信息表…” << endl;
ru.RuShow();
break;
case 4:
cout << “请输入要查找学生学号:”;
cin >> pnum;
pfind = ru.RuFind(pnum);
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;
}
Vue 编码基础
2.1.1. 组件规范
2.1.2. 模板中使用简单的表达式
2.1.3 指令都使用缩写形式
2.1.4 标签顺序保持一致
2.1.5 必须为 v-for 设置键值 key
2.1.6 v-show 与 v-if 选择
2.1.7 script 标签内部结构顺序
2.1.8 Vue Router 规范
Vue 项目目录规范
2.2.1 基础
2.2.2 使用 Vue-cli 脚手架
2.2.3 目录说明
2.2.4注释说明
2.2.5 其他