Title requirements
Implementing an integrated service platform for school festival organization and management with C
Use the keyboard to operate, note >
is the cursor, press Enter before entering information for an option
/**********************************************************
expense or outlayC++Simple management platform realized
The main idea is that the underlying operation(as screen output)modularization,Enables the realization of convenient
基于应expense or outlay场景运算量不大,This code has almost no time-space optimization
(That is, they're all big simulations,There's nothing clever about it.
(The code is confusing,Text alignment not resolved,Decoupling is not done well either,please forgive me
**********************************************************/
#include<iostream>
#include<>
#include<cstdlib>
#include<cstdio>
#include<>
#include<vector>
#include<string>
#include<algorithm>
#include<fstream>
#include<ctime>
#include<map>
#include<set>
#define ETR char(13)
#define ESC char(27)
#define DIR char(224)
#define UP char(72)
#define DOWN char(80)
#define LEFT char(75)
#define RIGHT char(77)
#define DEL char(8)
#define TAB char(9)
#define SEP char(5)
#define isChs(x) (point==x?" > ":" ")
#define isChs2(x) (point2==x?" > ":" ")
using namespace std;
const int INF=1e9;
bool RETB;
int point,MAX_ID,LIM=5000,NUM; //pointIt's the cursor.,MAX_IDis the total number,LIMis limited to the number of students enrolled in the school,NUMIt's a number.
struct User {
string name,password;
User():name(),password() {}
User(string _name,string _password) {
name=_name; password=_password;
}
bool operator <(const User &P) const {
if(name==) return password<;
return name<;
}
};
struct Res {
string name;
int id,bg,ed;
};
struct Don {
string name,school,item,exp,value;
};
struct Mostr {
string name,item,time,place,apr; int num,type;
};
struct App {
string name,content,place,time,apr; int num,cond;
};
map<User,int> rmp; //Various dynamic data structures(
map<int,User> mp;
set<string> S;
map<User,int>::iterator rit;
map<int,User>::iterator it;
string Hd,Tl;
vector<int> Type;
vector<string> Box,Imt,Chs;
vector<Res> RList;
vector<int> NList;
set<int> Vote;
map<int,int> Resnum;
vector<Mostr> MList;
map<string,int> Mcnt;
int occur[25];
vector<App> AList;
vector<Don> DList;
string Input() {
cout<<isChs(point);
string s;
getline(cin,s);
return s;
}
void ScrInit(string *s,int len,int type) {
if(type==1) {
();
for(int i=0;i<len;i++) Box.push_back(s[i]);
}
if(type==2) {
();
for(int i=0;i<len;i++) Imt.push_back(s[i]);
}
if(type==3) {
();
for(int i=0;i<len;i++) Chs.push_back(s[i]);
}
}
void PrintScr() {
system("cls");
cout<<isChs(INF)<<Hd<<endl;
cout<<string(60,'_')<<endl;
for(int i=0;i<();i++) cout<<isChs(i)<<Box[i]<<" "<<Imt[i]<<endl;
cout<<endl;
for(int i=0;i<();i++) cout<<isChs(i+())<<Chs[i]<<endl;
cout<<string(60,'_')<<endl;
cout<<isChs(INF)<<Tl<<endl;
}
void Error() {
Beep(rand()%1000+200,50);
}
int String_to_int(string s) {
int ret=0;
for(int i=0;i<();i++) {
if(!isdigit(s[i])) return ret;
ret=(ret<<3)+(ret<<1)+(s[i]^'0');
}
return ret;
}
string Int_to_string(int x) {
string ret; bool flag=0;
if(x<0) x=-x,flag=1;
while(x) ret=char(x%10+'0')+ret,x/=10;
if(ret=="") return "0";
else if(flag) return "-"+ret;
else return ret;
}
string Sint(string s) {
string ret;
for(int i=0;i<();i++) {
if(!isdigit(s[i])) return ret;
ret+=s[i];
}
return ret;
}
string Chsidt(int &);
string PrivateInput(string &);
void Menu(); //main menu
void Begin(); //System Initial Page
void Enter(); //Below are the various functions
void Register();
void Reserve();
void DonPrint(int);
void Donate();
void Apply();
void Souvenir();
void Giveout();
void Fileread(); //Documentation archiving
//////////////////////////////////////////////////////////////////////////////////////
int main() {
Fileread();
Begin();
}
//////////////////////////////////////////////////////////////////////////////////////
void Enter() { //login screen
string box[5]={"username","cryptographic"}; //The structure of the next function is almost identical
string imt[5]={"",""}; //This piece is output preprocessing
string chs[5]={"recognize"}; //The output is all dropped into theBox,Imt,Chsarray
string _hd="log in",_tl="";
string psw;
point=0;
PrintScr();
while(true) {
if(RETB) return;
ScrInit(box,2,1);
ScrInit(imt,2,2);
ScrInit(chs,1,3);
Hd=_hd; Tl=_tl;
PrintScr(); //Print Screen
char ch=_getch(); //_getch()Cancel Showback
if(ch==ETR) {
if(point==0) imt[0]=Input();
if(point==1) imt[1]=PrivateInput(psw);
if(point==2) {
if((rit=(User(imt[0],psw)))!=()) {
NUM=rit->second;
Menu();
}
else _tl="username或cryptographic错误";
}
}
else if(ch==ESC) return;
else if(ch==DIR) { //cursor movement
ch=_getch();
if(ch==UP) point=(point+2)%3;
else if(ch==DOWN) point=(point+1)%3;
else Error();
}
else Error();
}
}
string Chsidt(int &idt) {
string box[5]={"schoolchildren","teachers","staff member","travelers",""};
string imt[5]={"","","",""};
string chs[5]={""};
string _hd="You are",_tl="";
point=0;
while(true) {
ScrInit(box,4,1);
ScrInit(imt,4,2);
ScrInit(chs,0,3);
Hd=_hd; Tl=_tl;
PrintScr();
char ch=_getch();
if(ch==ETR) {
idt=point; return box[point];
}
else if(ch==ESC) return box[4];
else if(ch==DIR) {
ch=_getch();
if(ch==UP) point=(point+3)%4;
else if(ch==DOWN) point=(point+1)%4;
else Error();
}
else Error();
}
}
void Register() {
string box[5]={"username","cryptographic","Identity Selection"};
string imt[5]={"","",""};
string chs[5]={"recognize"};
string _hd="enrollment",_tl="";
string psw; int idt=4;
point=0;
while(true) {
if(RETB) return;
ScrInit(box,3,1);
ScrInit(imt,3,2);
ScrInit(chs,1,3);
Hd=_hd; Tl=_tl;
PrintScr();
char ch=_getch();
if(ch==ETR) {
point=(point+4)%4;
if(point==0) imt[0]=Input();
if(point==1) imt[1]=PrivateInput(psw);
if(point==2) imt[2]=Chsidt(idt);
if(point==3) {
if((imt[0])!=()) {
_tl="username已存在";
}
else {
if(imt[0]==""||imt[1]==""||imt[2]=="") {
_tl="Please improve the input information"; continue;
}
mp[++MAX_ID]=User(imt[0],psw);
rmp[User(imt[0],psw)]=MAX_ID;
(imt[0]);
Type.push_back(idt);
NUM=MAX_ID;
ofstream ots;
("",ios::app);
ots<<imt[0]<<SEP<<psw<<SEP<<idt<<endl;
();
; Menu();
}
}
}
else if(ch==ESC) return;
else if(ch==DIR) {
ch=_getch();
if(ch==UP) point=(point+3)%4;
else if(ch==DOWN) point=(point+1)%4;
else Error();
}
else Error();
}
}
void Menu() {
string box[10]={"appear (in a newspaper etc)","Visitor registration system","Donor statistics system","Activity Application Reporting System","Gala Ticket Distribution System","Material management system"};
string imt[10]={"","","","","",""};
string chs[5]={""};
string _hd="menu",_tl="";
string psw; int idt=0;
point=0;
while(true) {
if(RETB) return;
ScrInit(box,6,1);
ScrInit(imt,6,2);
ScrInit(chs,0,3);
Hd=_hd; Tl=_tl;
PrintScr();
char ch=_getch();
if(ch==ETR) {
point=(point+6)%6;
if(point==0) RETB=1;
else if(point==1) Reserve();
else if(point==2) Donate();
else if(point==3) Apply();
else if(point==4) Giveout();
else if(point==5) Souvenir();
}
// else if(ch==ESC) return;
else if(ch==DIR) {
ch=_getch();
if(ch==UP) point=(point+5)%6;
else if(ch==DOWN) point=(point+1)%6;
else Error();
}
else Error();
}
}
string PrivateInput(string &ret) {
string s;
ret="";
cout<<isChs(point);
char ch=_getch();
while(ch!=ETR) {
if(ch==DIR) ch=_getch();
else if(ch==DEL) {
if(()) {
(()-1,1);
(()-1,1);
PrintScr();
cout<<isChs(point)<<s;
}
}
else {
cout<<'*';
s+='*'; ret+=ch;
}
ch=_getch();
}
return s;
}
void Begin() {
string box[5]={"log in","enrollment"};
string imt[5]={"",""};
string chs[5]={""};
string _hd="欢迎使expense or outlay校庆组织与管理综合服务平台",_tl="check or refer toEnterkey to make a selection,check or refer toEscfall back to the next higher level";
string psw;
point=0;
while(true) {
RETB=0;
ScrInit(box,2,1);
ScrInit(imt,2,2);
ScrInit(chs,0,3);
Hd=_hd; Tl=_tl;
PrintScr();
char ch=_getch();
if(ch==ETR) {
if(point==0) Enter();
if(point==1) Register();
}
else if(ch==ESC) return;
else if(ch==DIR) {
ch=_getch();
if(ch==UP) point=(point+1)%2;
else if(ch==DOWN) point=(point+1)%2;
else Error();
}
else Error();
}
}
bool cmp3(Res A,Res B) {
if(==) return <;
return <;
}
int Readint() {
int x; cin>>x;
return x;
}
bool Checklim(int l,int r) {
for(int i=l;i<=r;i++) if(occur[i]==LIM) return 1;
return 0;
}
void Reserve() {
if(NUM==2) {
Hd="Reservationist Management List";
string box[5]={"schoolchildren","teachers","staff member","travelers"};
(); (); ();
Box.push_back("name and surname\tIdentity information\tDate of entry\tLeaving time");
Imt.push_back("");
sort((),(),cmp3);
for(int i=0;i<();i++) {
Box.push_back(RList[i].name+"\t"+box[RList[i].id]+"\t"+
Int_to_string(RList[i].bg)+":00\t"+Int_to_string(RList[i].ed)+":00");
Imt.push_back("");
}
PrintScr();
while(true) {
char ch=_getch();
if(ch==ESC) return;
else Error();
}
}
else {
if((NUM)!=()) {
Res tp=RList[Resnum[NUM]];
string box[5]={"Date of entry\tLeaving time",Int_to_string()+":00\t"+Int_to_string()+":00"};
string imt[5]={"",""};
string chs[5]={"OK"};
string _hd="Your Appointment Time",_tl="";
string psw;
point=INF-1;
while(true) {
ScrInit(box,2,1);
ScrInit(imt,2,2);
ScrInit(chs,0,3);
Hd=_hd; Tl=_tl;
PrintScr();
char ch=_getch();
if(ch==ESC) return;
else Error();
}
}
else {
string box[5]={"Date of entry(hour)","Leaving time(hour)"};
string imt[5]={"",""};
string chs[5]={"recognize"};
string _hd="Visiting School Registration Appointment",_tl="";
string psw;
point=0;
while(true) {
ScrInit(box,2,1);
ScrInit(imt,2,2);
ScrInit(chs,1,3);
Hd=_hd; Tl=_tl;
PrintScr();
char ch=_getch();
if(ch==ETR) {
if(point==0) imt[0]=Sint(Input());
if(point==1) imt[1]=Sint(Input());
if(point==2) {
int l=String_to_int(imt[0]),r=String_to_int(imt[1]);
if(l>r||l<0||l>=24||r<0||r>=24) _tl="Illegal input";
else if(Checklim(l,r)) _tl="超出该段hour间预约来访人数限制,请重新选择hour间";
else {
Res tp; =mp[NUM].name; =Type[NUM];
=l; =r;
for(int i=l;i<=r;i++) occur[i]++;
RList.push_back(tp);
Resnum[NUM]=()-1;
ofstream ots;
("",ios::app);
ots<<<<SEP<<NUM<<SEP<<<<SEP<<<<endl;
();
return;
}
}
}
else if(ch==ESC) return;
else if(ch==DIR) {
ch=_getch();
if(ch==UP) point=(point+2)%3;
else if(ch==DOWN) point=(point+1)%3;
else Error();
}
else Error();
}
}
}
}
bool isSubstr(string s,string t) {
for(int i=0;i+()-1<();i++) {
if((i,())==t) return 1;
}
return 0;
}
bool cmp1(Don A,Don B) {return <;}
bool cmp2(Don A,Don B) {return String_to_int()>String_to_int();}
void DonPrint(int type) {
if(type==1) {
sort((),(),cmp1);
(); (); ();
Box.push_back(" ▽name and surname\tAffiliated Institutions\tDonation of materials\tfig. values (ethical, cultural etc)(unit of money (in PRC: Chinese yuan, in USA: dollar, etc))\t期望expense or outlay途");
Imt.push_back("");
for(int i=0;i<();i++) {
Box.push_back(DList[i].name+"\t"+DList[i].school+"\t"+
DList[i].item+"\t"+DList[i].value+"\t"+DList[i].exp);
Imt.push_back("");
}
}
else if(type==2) {
sort((),(),cmp2);
(); ();
Box.push_back(" name and surname\tAffiliated Institutions\tDonation of materials\t▽fig. values (ethical, cultural etc)(unit of money (in PRC: Chinese yuan, in USA: dollar, etc))\t期望expense or outlay途");
Imt.push_back("");
for(int i=0;i<min(10,(int)());i++) {
Box.push_back(DList[i].name+"\t"+DList[i].school+"\t"+
DList[i].item+"\t"+DList[i].value+"\t"+DList[i].exp);
Imt.push_back("");
}
}
else if(type==3) {
Tl="Please enter the institution you want to search";
PrintScr();
string s=Input();
(); ();
Box.push_back(" name and surname\t▽Affiliated Institutions\tDonation of materials\tfig. values (ethical, cultural etc)(unit of money (in PRC: Chinese yuan, in USA: dollar, etc))\t期望expense or outlay途");
Imt.push_back("");
for(int i=0;i<();i++) {
if(!isSubstr(DList[i].school,s)) continue;
Box.push_back(DList[i].name+"\t"+DList[i].school+"\t"+
DList[i].item+"\t"+DList[i].value+"\t"+DList[i].exp);
Imt.push_back("");
}
}
Hd="Alumni Donation List";
PrintScr();
}
void Donate() {
if(Type[NUM]==2) {
Donad:;
string box[10]={"name and surname","Affiliated Institutions","Donation of materials","fig. values (ethical, cultural etc)(unit of money (in PRC: Chinese yuan, in USA: dollar, etc))","期望expense or outlay途"};
string imt[10]={"","","","",""};
string chs[5]={"recognize"};
string _hd="Add Donation Entry",_tl="check or refer toCView List";
string psw; int idt=0;
point=0;
while(true) {
ScrInit(box,5,1);
ScrInit(imt,5,2);
ScrInit(chs,1,3);
Hd=_hd; Tl=_tl;
PrintScr();
char ch=_getch();
if(ch==ETR) {
point=(point+6)%6;
if(point==3) imt[point]=Sint(Input());
else if(point<5) imt[point]=Input();
else if(point==5) {
Don tp; =imt[0]; =imt[1];
=imt[2]; =Sint(imt[3]); =imt[4];
DList.push_back(tp);
ofstream ots;
("",ios::app);
ots<<<<SEP<<<<SEP<<<<SEP<<
<<SEP<<<<endl;
();
goto Donck;
}
}
else if(ch==ESC) return;
else if(ch==DIR) {
ch=_getch();
if(ch==UP) point=(point+5)%6;
else if(ch==DOWN) point=(point+1)%6;
else Error();
}
else if(ch=='c') goto Donck;
else Error();
}
}
else {
Donck:;
point=INF-1; int type=1;
Tl="check or refer toTabSwitching list types\n check or refer toAAdd Donation Entry";
point=INF-1;
while(true) {
DonPrint(type);
Tl="check or refer toTabSwitching list types\n check or refer toAAdd Donation Entry";
char ch=_getch();
if(ch==TAB) type=type%3+1;
else if(ch==ESC) return;
else if(ch=='a') {
if(Type[NUM]==2) goto Donad;
else Tl="insufficient authority";
}
else Error();
}
}
}
void CheckApply() {
(); (); ();
Hd="Your application form"; Tl="";
Box.push_back("name and surname\t Activities \tEvent Location\t活动hour间\tApplication Status\tapprover");
Imt.push_back("");
string box[5]={"pending","Application approved","Application not approved"};
for(int i=0;i<();i++) {
if(AList[i].num!=NUM) continue;
Box.push_back(AList[i].name+"\t"+AList[i].content+"\t"+AList[i].place
+"\t"+AList[i].time+"\t"+box[AList[i].cond]+"\t"+AList[i].apr);
Imt.push_back("");
}
PrintScr();
point=INF-1;
while(true) {
char ch=_getch();
if(ch==ESC) return;
else Error;
}
}
void AddApply() {
string box[10]={"name and surname","Activities","Event Location","活动hour间"};
string imt[10]={"","","",""};
string chs[5]={"submit (a report etc)"};
string _hd="Add Application Form",_tl="";
string psw; int idt=4;
point=0;
while(true) {
ScrInit(box,4,1);
ScrInit(imt,4,2);
ScrInit(chs,1,3);
Hd=_hd; Tl=_tl;
PrintScr();
char ch=_getch();
if(ch==ETR) {
if(point<4) imt[point]=Input();
if(point==4) {
for(int i=0;i<4;i++) if(imt[i]=="") {
_tl="Please improve the input information"; goto AAE;
}
App tp; =imt[0]; =imt[1];
=imt[2]; =imt[3];
=NUM; =0; =" ";
AList.push_back(tp);
ofstream ots;
("",ios::app);
ots<<<<SEP<<<<SEP<<<<SEP<<
<<SEP<<<<SEP<<<<SEP<<<<endl;
();
return;
}
}
else if(ch==ESC) return;
else if(ch==DIR) {
ch=_getch();
if(ch==UP) point=(point+4)%5;
else if(ch==DOWN) point=(point+1)%5;
else Error();
}
else Error();
AAE:;
}
}
bool cmp4(App A,App B) {return <;}
void AprApply() {
sort((),(),cmp4);
(); (); ();
Hd="Event Application Approval"; Tl="";
Box.push_back("name and surname\t Activities \tEvent Location\t活动hour间\tApplication Status");
Imt.push_back("");
string box[5]={"pending","Application approved","Application not approved"};
for(int i=0;i<();i++) {
Box.push_back(AList[i].name+"\t"+AList[i].content+"\t"+
AList[i].place+"\t"+AList[i].time+"\t"+box[AList[i].cond]);
Imt.push_back("");
}
int len=();
point=1;
while(true) {
PrintScr();
char ch=_getch();
if(ch==ETR) {
if(point<=len) {
if(!len) continue;
int point2=1;
while(true) {
PrintScr();
cout<<isChs2(0)<<"agree with"<<endl<<isChs2(1)<<"rejection"<<endl;
ch=_getch();
if(ch==ETR) {
AList[point-1].cond=point2+1;
AList[point-1].apr=mp[NUM].name;
Box[point]=AList[point-1].name+"\t"+AList[point-1].content+"\t"+
AList[point-1].place+"\t"+AList[point-1].time+"\t"+box[AList[point-1].cond];
ofstream ots;
("",ios::out);
for(int i=0;i<();i++) { //swipe a watch,dynamic storage
App tp=AList[i];
ots<<<<SEP<<<<SEP<<<<SEP<<
<<SEP<<<<SEP<<<<SEP<<<<endl;
}
();
break;
}
else if(ch==ESC) break;
else if(ch==DIR) {
ch=_getch();
if(ch==UP) point2=(point2+1)%2;
else if(ch==DOWN) point2=(point2+1)%2;
else Error();
}
else Error();
}
}
}
else if(ch==ESC) return;
else if(ch==DIR) {
ch=_getch();
if(!len) continue;
if(ch==UP) point=(point+len-1-1)%len+1;
else if(ch==DOWN) point=(point)%len+1;
else Error();
}
else Error();
}
}
void Apply() {
if(Type[NUM]==2) AprApply();
else {
string box[5]={"Add Application Form","View Application Form"};
string imt[5]={"","",""};
string chs[5]={""};
string _hd="Apply",_tl="";
string psw; int idt=4;
point=0;
while(true) {
ScrInit(box,2,1);
ScrInit(imt,2,2);
ScrInit(chs,0,3);
Hd=_hd; Tl=_tl;
PrintScr();
char ch=_getch();
if(ch==ETR) {
if(Type[NUM]!=0) {
_tl="insufficient authority";
continue;
}
point=(point+2)%2;
if(point==0) AddApply();
if(point==1) CheckApply();
}
else if(ch==ESC) return;
else if(ch==DIR) {
ch=_getch();
if(ch==UP) point=(point+1)%2;
else if(ch==DOWN) point=(point+1)%2;
else Error();
}
else Error();
}
}
}
string Gettime() {
struct tm *ptr;
time_t now=time(NULL);
ptr=gmtime(&now);
return Int_to_string(ptr->tm_year+1900)+"."+
Int_to_string(ptr->tm_mon)+"."+Int_to_string(ptr->tm_mday);
}
void Checkrest() {
();
(); (); ();
Hd="Material Warehouse Management Inquiry"; Tl="";
Box.push_back("Name of material\tleftover");
Imt.push_back("");
for(int i=0;i<();i++) {
if((MList[i].item)!=()) {
Mcnt[MList[i].item]+=MList[i].num*(MList[i].type==1?1:-1);
}
else Mcnt[MList[i].item]=MList[i].num*(MList[i].type==1?1:-1);
}
for(map<string,int>::iterator it=();it!=();it++) {
Box.push_back(it->first+"\t"+Int_to_string(it->second));
Imt.push_back("");
}
Box.push_back(string(60,'_'));
Imt.push_back("");
Box.push_back("Direction of material flows\tName of material\trelevant unit(educational institution)\trelevant person\tquantities\tdates\tagent");
Imt.push_back("");
for(int i=()-1;i>=0;i--) {
Box.push_back(string(0,' ')+(MList[i].type==1?"inflow":"disgorge")+"\t"+MList[i].item
+"\t"+MList[i].place+"\t"+MList[i].name+"\t"+Int_to_string(MList[i].num)+"\t"+
MList[i].time+"\t"+MList[i].apr);
Imt.push_back("");
}
PrintScr();
point=INF-1;
while(true) {
char ch=_getch();
if(ch==ESC) return;
else Error;
}
}
void Import() {
string box[10]={"Name of material","sourcing location","purchasers","procurement volume"};
string imt[10]={"","","",""};
string chs[5]={"submit (a report etc)"};
string _hd="Adding material input entries",_tl="";
string psw; int idt=4;
point=0;
while(true) {
ScrInit(box,4,1);
ScrInit(imt,4,2);
ScrInit(chs,1,3);
Hd=_hd; Tl=_tl;
PrintScr();
char ch=_getch();
if(ch==ETR) {
if(point==3) imt[point]=Sint(Input());
else if(point<3) imt[point]=Input();
else if(point==4) {
for(int i=0;i<4;i++) if(imt[i]=="") {
_tl="Please improve the input information"; goto EME;
}
Mostr tp; =1; =imt[0];
=imt[1]; =imt[2];
=String_to_int(imt[3]);
=Gettime(); =mp[NUM].name;
MList.push_back(tp);
ofstream ots;
("",ios::app);
ots<<<<SEP<<<<SEP<<<<SEP<<
<<SEP<<<<SEP<<<<SEP<<<<endl;
();
return;
}
}
else if(ch==ESC) return;
else if(ch==DIR) {
ch=_getch();
if(ch==UP) point=(point+4)%5;
else if(ch==DOWN) point=(point+1)%5;
else Error();
}
else Error();
EME:;
}
}
void Export() {
string box[10]={"Name of material","sourcing location","purchasers","procurement volume"};
string imt[10]={"","","",""};
string chs[5]={"submit (a report etc)"};
string _hd="Adding material output entries",_tl="";
string psw; int idt=4;
point=0;
while(true) {
ScrInit(box,4,1);
ScrInit(imt,4,2);
ScrInit(chs,1,3);
Hd=_hd; Tl=_tl;
PrintScr();
char ch=_getch();
if(ch==ETR) {
if(point==3) imt[point]=Sint(Input());
else if(point<3) imt[point]=Input();
else if(point==4) {
for(int i=0;i<4;i++) if(imt[i]=="") {
_tl="Please improve the input information"; goto EME;
}
Mostr tp; =2; =imt[0];
=imt[1]; =imt[2];
=String_to_int(imt[3]);
=Gettime(); =mp[NUM].name;
MList.push_back(tp);
ofstream ots;
("",ios::app);
ots<<<<SEP<<<<SEP<<<<SEP<<
<<SEP<<<<SEP<<<<SEP<<<<endl;
();
return;
}
}
else if(ch==ESC) return;
else if(ch==DIR) {
ch=_getch();
if(ch==UP) point=(point+4)%5;
else if(ch==DOWN) point=(point+1)%5;
else Error();
}
else Error();
EME:;
}
}
void Souvenir() {
string box[5]={"View Material Warehousing","Adding material input information","Adding material output information"};
string imt[5]={"","",""};
string chs[5]={""};
string _hd="Material management system",_tl="";
string psw;
point=0;
PrintScr();
while(true) {
if(RETB) return;
ScrInit(box,3,1);
ScrInit(imt,3,2);
ScrInit(chs,0,3);
Hd=_hd; Tl=_tl;
PrintScr();
char ch=_getch();
if(ch==ETR) {
if(Type[NUM]!=2) {_tl="insufficient authority"; goto SED;}
if(point==0) Checkrest();
else if(point==1) Import();
else if(point==2) Export();
}
else if(ch==ESC) return;
else if(ch==DIR) {
ch=_getch();
if(ch==UP) point=(point+2)%3;
else if(ch==DOWN) point=(point+1)%3;
else Error();
}
else Error();
SED:;
}
}
void Giveout() {
if(Type[NUM]==2) {
string box[5]={"Please enter the total number of votes distributed"};
string imt[5]={"","",""};
string chs[5]={"recognize"};
string _hd="Ticket distribution",_tl="";
string psw;
point=0;
PrintScr();
while(true) {
if(RETB) return;
ScrInit(box,1,1);
ScrInit(imt,1,2);
ScrInit(chs,1,3);
Hd=_hd; Tl=_tl;
PrintScr();
char ch=_getch();
if(ch==ETR) {
if(point==0) imt[0]=Sint(Input());
else if(point==1) {
if(imt[0]=="") _tl="Please improve the input information";
else {
(); ();
for(int i=1;i<=MAX_ID;i++) {
NList.push_back(i);
}
random_shuffle((),());
int lim=String_to_int(imt[0]);
for(int i=0;i<lim&&i<MAX_ID;i++) (NList[i]);
Tl="Distribution completed"; PrintScr(); Sleep(1000); goto CSF;
}
}
}
else if(ch==ESC) return;
else if(ch==DIR) {
ch=_getch();
if(ch==UP) point=(point+1)%2;
else if(ch==DOWN) point=(point+1)%2;
else Error();
}
else Error();
}
}
else {
CSF:;
(); (); ();
Hd="Results of Gala Ticket Distribution"; Tl="";
if(!()) Box.push_back("In distribution...");
else if((NUM)==()) Box.push_back("unfortunately,You have not been issued a ticket");
else Box.push_back("You have been awarded a ticket");
Imt.push_back("");
PrintScr();
point=INF-1;
while(true) {
char ch=_getch();
if(ch==ESC) return;
else Error;
}
}
}
void Fileread() {
Type.push_back(0);
string s;
ifstream ins;
("",ios::in);
while(getline(ins,s)) {
int pos=0;
User tp; string t;
for(;s[pos]!=SEP;++pos) +=s[pos];
++pos;
for(;s[pos]!=SEP;++pos) +=s[pos];
++pos;
for(;pos<();++pos) t+=s[pos];
mp[++MAX_ID]=tp; rmp[tp]=MAX_ID; ();
Type.push_back(String_to_int(Sint(t)));
// cout<<<<' '<<<<' '<<rmp[tp]<<endl;
// Sleep(2000);
}
();
("",ios::in);
while(getline(ins,s)) {
int pos=0;
Res tp; string t1,t2,t3;
for(;s[pos]!=SEP;++pos) +=s[pos];
++pos;
for(;s[pos]!=SEP;++pos) t1+=s[pos];
++pos;
for(;s[pos]!=SEP;++pos) t2+=s[pos];
++pos;
for(;pos<();++pos) t3+=s[pos];
int num=String_to_int(Sint(t1));
=Type[num];
=String_to_int(Sint(t2));
=String_to_int(Sint(t3));
int l=,r=;
for(int i=l;i<=r;i++) occur[i]++;
RList.push_back(tp);
Resnum[num]=()-1;
}
();
("",ios::in);
while(getline(ins,s)) {
int pos=0;
Don tp; string t1,t2;
for(;s[pos]!=SEP;++pos) +=s[pos];
++pos;
for(;s[pos]!=SEP;++pos) +=s[pos];
++pos;
for(;s[pos]!=SEP;++pos) +=s[pos];
++pos;
for(;s[pos]!=SEP;++pos) +=s[pos];
++pos;
for(;pos<();++pos) +=s[pos];
DList.push_back(tp);
}
();
("",ios::in);
while(getline(ins,s)) {
int pos=0;
App tp; string t1,t2;
for(;s[pos]!=SEP;++pos) +=s[pos];
++pos;
for(;s[pos]!=SEP;++pos) +=s[pos];
++pos;
for(;s[pos]!=SEP;++pos) +=s[pos];
++pos;
for(;s[pos]!=SEP;++pos) +=s[pos];
++pos;
for(;s[pos]!=SEP;++pos) +=s[pos];
++pos;
for(;s[pos]!=SEP;++pos) t1+=s[pos];
++pos;
for(;pos<();++pos) t2+=s[pos];
=String_to_int(Sint(t1));
=String_to_int(Sint(t2));
AList.push_back(tp);
}
();
("",ios::in);
while(getline(ins,s)) {
int pos=0;
Mostr tp; string t1,t2;
for(;s[pos]!=SEP;++pos) +=s[pos];
++pos;
for(;s[pos]!=SEP;++pos) +=s[pos];
++pos;
for(;s[pos]!=SEP;++pos) +=s[pos];
++pos;
for(;s[pos]!=SEP;++pos) +=s[pos];
++pos;
for(;s[pos]!=SEP;++pos) +=s[pos];
++pos;
for(;s[pos]!=SEP;++pos) t1+=s[pos];
++pos;
for(;pos<();++pos) t2+=s[pos];
=String_to_int(Sint(t1));
=String_to_int(Sint(t2));
MList.push_back(tp);
}
();
}