?? main.cpp
字號:
#include<iostream.h>
#include<fstream.h>
#include<stdlib.h>
#include<string.h>
#include<assert.h>
#include<iomanip.h>
#include"person.h"
#include"member.h"
#include"junior_member.h"
#include"senior_member.h"
#include"coach.h"
#include"junior_member_link.h"
#include"senior_member_link.h"
#include"coach_link.h"
void main()
{ junior_member *head_j=NULL;
senior_member *head_s=NULL;
coach *head_c=NULL;
int choice;
const int i=123;
int j,h;
long k;
char fileName[30];
cout<<"******************華工高爾夫俱樂部人員管理系統******************"<<endl;
cout<<"*** 請選擇操作^^ ***"<<endl;
cout<<"*** 1:初級會員 ***"<<endl;
cout<<"*** 2:高級會員 ***"<<endl;
cout<<"*** 3:教練員 ***"<<endl;
cout<<"*** 0:退出人員管理系統 ***"<<endl;
cout<<"****************************************************************"<<endl;
cin>>choice;
while(choice)
{switch(choice)
{case 1:
cout<<"***************初級會員***************"<<endl;
cout<<"* 1:添加初級會員 *"<<endl;
cout<<"* 2:刪除初級會員 *"<<endl;
cout<<"* 3:查詢某個初級會員的編號、姓名 *"<<endl;
cout<<"* 4:初級會員查看自己的全部資料 *"<<endl;
cout<<"* 5:管理員修改某個初級會員的資料 *"<<endl;
cout<<"* 6:會員修改自己的密碼 *"<<endl;
cout<<"* 7:管理員查看初級會員的全部資料 *"<<endl;
cout<<"* 8:保存初級會員資料 *"<<endl;
cout<<"* 9:在文本文件中追加新資料 *"<<endl;
cout<<"* 0:退出 *"<<endl;
cout<<"**************************************"<<endl;
cin>>choice;
while(choice)
{switch(choice)
{case 1:cout<<"請輸入管理員密碼"<<endl;
cin>>j;
if(i==j)
{insert_j(head_j);}
break;
case 2:cout<<"請輸入管理員密碼"<<endl;
cin>>j;
if(i==j)
{cout<<"請輸入初級會員編號"<<endl;
cin>>k;
del_j(head_j,k);
}
break;
case 3:cout<<"請輸入初級會員編號"<<endl;
cin>>k;
show_j1(head_j,k);
break;
case 4:cout<<"請輸入初級會員編號"<<endl;
cin>>k;
show_j2(head_j,k);
break;
case 5:cout<<"請輸入管理員密碼"<<endl;
cin>>j;
if(i==j)
{cout<<"請輸入初級會員編號"<<endl;
cin>>k;
change_j(head_j,k);
}
break;
case 6:cout<<"請輸入初級會員編號"<<endl;
cin>>k;
reset_password_j(head_j,k);
break;
case 7:cout<<"請輸入管理員密碼"<<endl;
cin>>j;
if(i==j)
{show_j(head_j);}
break;
case 8:cout<<"請輸入管理員密碼"<<endl;
cin>>j;
if(i==j)
{set_file_j(head_j);}
break;
case 9:cout<<"請輸入管理員密碼"<<endl;
cin>>j;
if(i==j)
{cout<<"請輸入要追加初級會員記錄的文本文件名!"<<endl;
cin>>fileName;
Append_j(head_j,fileName);
}
break;
case 0:cout<<"退出初級會員管理系統"<<endl;return;
default:cout<<"輸入錯誤,請再輸入"<<endl;
}
cout<<"***************初級會員***************"<<endl;
cout<<"* 1:添加初級會員 *"<<endl;
cout<<"* 2:刪除初級會員 *"<<endl;
cout<<"* 3:查詢某個初級會員的編號、姓名 *"<<endl;
cout<<"* 4:初級會員查看自己的全部資料 *"<<endl;
cout<<"* 5:管理員修改某個初級會員的資料 *"<<endl;
cout<<"* 6:會員修改自己的密碼 *"<<endl;
cout<<"* 7:管理員查看初級會員的全部資料 *"<<endl;
cout<<"* 8:保存初級會員資料 *"<<endl;
cout<<"* 9:在文本文件中追加新資料 *"<<endl;
cout<<"* 0:退出 *"<<endl;
cout<<"**************************************"<<endl;
cin>>choice;
}
cout<<"是否保存初級會員資料在文本文件?是按1,否按0!"<<endl;
cin>>h;
if(h){cout<<"請輸入管理員密碼"<<endl;
cin>>j;
if(i==j)
{set_file_j(head_j);}
}
else
{cout<<"是否在初級會員文本文件中追加記錄?是按1,否按0!"<<endl;
cin>>h;
if(h){cout<<"請輸入管理員密碼"<<endl;
cin>>j;
if(i==j)
{cout<<"請輸入要追加初級會員記錄的文本文件名!"<<endl;
cin>>fileName;
Append_j(head_j,fileName);
}
}
}
break;
case 2:
cout<<"***************高級會員***************"<<endl;
cout<<"* 1:添加高級會員 *"<<endl;
cout<<"* 2:刪除高級會員 *"<<endl;
cout<<"* 3:查詢某個高級會員的編號、姓名 *"<<endl;
cout<<"* 4:高級會員查看自己的全部資料 *"<<endl;
cout<<"* 5:管理員修改某個高級會員的資料 *"<<endl;
cout<<"* 6:會員修改自己的密碼 *"<<endl;
cout<<"* 7:管理員查看高級會員的全部資料 *"<<endl;
cout<<"* 8:保存高級會員資料 *"<<endl;
cout<<"* 9:在文本文件中追加新資料 *"<<endl;
cout<<"* 0:退出 *"<<endl;
cout<<"**************************************"<<endl;
cin>>choice;
while(choice)
{switch(choice)
{case 1:cout<<"請輸入管理員密碼"<<endl;
cin>>j;
if(i==j)
{insert_s(head_s);}
break;
case 2:cout<<"請輸入管理員密碼"<<endl;
cin>>j;
if(i==j)
{cout<<"請輸入高級會員編號"<<endl;
cin>>k;
del_s(head_s,k);
}
break;
case 3:cout<<"請輸入高級會員編號"<<endl;
cin>>k;
show_s1(head_s,k);
break;
case 4:cout<<"請輸入高級會員編號"<<endl;
cin>>k;
show_s2(head_s,k);
break;
case 5:cout<<"請輸入管理員密碼"<<endl;
cin>>j;
if(i==j)
{cout<<"請輸入高級會員編號"<<endl;
cin>>k;
change_s(head_s,k);
}
break;
case 6:cout<<"請輸入高級會員編號"<<endl;
cin>>k;
reset_password_s(head_s,k);
break;
case 7:cout<<"請輸入管理員密碼"<<endl;
cin>>j;
if(i==j)
{show_s(head_s);}
break;
case 8:cout<<"請輸入管理員密碼"<<endl;
cin>>j;
if(i==j)
{set_file_s(head_s);}
break;
case 9:cout<<"請輸入管理員密碼"<<endl;
cin>>j;
if(i==j)
{cout<<"請輸入要追加高級會員記錄的文本文件名!"<<endl;
cin>>fileName;
Append_s(head_s,fileName);
}
break;
case 0:cout<<"退出高級會員管理系統"<<endl;return;
default:cout<<"輸入錯誤,請再輸入"<<endl;
}
cout<<"***************高級會員***************"<<endl;
cout<<"* 1:添加高級會員 *"<<endl;
cout<<"* 2:刪除高級會員 *"<<endl;
cout<<"* 3:查詢某個高級會員的編號、姓名 *"<<endl;
cout<<"* 4:高級會員查看自己的全部資料 *"<<endl;
cout<<"* 5:管理員修改某個高級會員的資料 *"<<endl;
cout<<"* 6:會員修改自己的密碼 *"<<endl;
cout<<"* 7:管理員查看高級會員的全部資料 *"<<endl;
cout<<"* 8:保存高級會員資料 *"<<endl;
cout<<"* 9:在文本文件中追加新資料 *"<<endl;
cout<<"* 0:退出 *"<<endl;
cout<<"**************************************"<<endl;
cin>>choice;
}
cout<<"是否保存高級會員資料在文本文件?是按1,否按0!"<<endl;
cin>>h;
if(h){cout<<"請輸入管理員密碼"<<endl;
cin>>j;
if(i==j)
{set_file_s(head_s);}
}
else
{cout<<"是否在高級會員文本文件中追加記錄?是按1,否按0!"<<endl;
cin>>h;
if(h){cout<<"請輸入管理員密碼"<<endl;
cin>>j;
if(i==j)
{cout<<"請輸入要追加高級會員記錄的文本文件名!"<<endl;
cin>>fileName;
Append_s(head_s,fileName);
}
}
}
break;
case 3:
cout<<"***************教練員***************"<<endl;
cout<<"* 1:添加教練員 *"<<endl;
cout<<"* 2:刪除教練員 *"<<endl;
cout<<"* 3:查詢某個教練員的編號、姓名 *"<<endl;
cout<<"* 4:教練員查看自己的全部資料 *"<<endl;
cout<<"* 5:管理員修改某個教練員的資料 *"<<endl;
cout<<"* 6:教練員修改自己的密碼 *"<<endl;
cout<<"* 7:管理員查看教練員的全部資料 *"<<endl;
cout<<"* 8:保存教練員資料于文本文件 *"<<endl;
cout<<"* 9:在教練員文本文件中追加記錄 *"<<endl;
cout<<"* 0:退出教練員管理系統 *"<<endl;
cout<<"**************************************"<<endl;
cin>>choice;
while(choice)
{switch(choice)
{case 1:cout<<"請輸入管理員密碼"<<endl;
cin>>j;
if(i==j)
{insert_c(head_c);}
break;
case 2:cout<<"請輸入管理員密碼"<<endl;
cin>>j;
if(i==j)
{cout<<"請輸入教練員編號"<<endl;
cin>>k;
del_c(head_c,k);
}
break;
case 3:cout<<"請輸入教練員編號"<<endl;
cin>>k;
show_c1(head_c,k);
break;
case 4:cout<<"請輸入教練員編號"<<endl;
cin>>k;
show_c2(head_c,k);
break;
case 5:cout<<"請輸入管理員密碼"<<endl;
cin>>j;
if(i==j)
{cout<<"請輸入教練員編號"<<endl;
cin>>k;
change_c(head_c,k);
}
break;
case 6:cout<<"請輸入教練員編號"<<endl;
cin>>k;
reset_password_c(head_c,k);
break;
case 7:cout<<"請輸入管理員密碼"<<endl;
cin>>j;
if(i==j)
{show_c(head_c);}
break;
case 8:cout<<"請輸入管理員密碼"<<endl;
cin>>j;
if(i==j)
{set_file_c(head_c);}
break;
case 9:cout<<"請輸入管理員密碼"<<endl;
cin>>j;
if(i==j)
{cout<<"請輸入要追加教練員記錄的文本文件名!"<<endl;
cin>>fileName;
Append_c(head_c,fileName);
}
break;
case 0:cout<<"退出教練員管理系統"<<endl;return;
default:cout<<"輸入錯誤,請再輸入"<<endl;
}
cout<<"***************教練員***************"<<endl;
cout<<"* 1:添加教練員 *"<<endl;
cout<<"* 2:刪除教練員 *"<<endl;
cout<<"* 3:查詢某個教練員的編號、姓名 *"<<endl;
cout<<"* 4:教練員查看自己的全部資料 *"<<endl;
cout<<"* 5:管理員修改某個教練員的資料 *"<<endl;
cout<<"* 6:教練員修改自己的密碼 *"<<endl;
cout<<"* 7:管理員查看教練員的全部資料 *"<<endl;
cout<<"* 8:保存教練員資料于文本文件 *"<<endl;
cout<<"* 9:在教練員文本文件中追加記錄 *"<<endl;
cout<<"* 0:退出教練員管理系統 *"<<endl;
cout<<"**************************************"<<endl;
cin>>choice;
}
cout<<"是否保存教練員資料在文本文件?是按1,否按0!"<<endl;
cin>>h;
if(h){cout<<"請輸入管理員密碼"<<endl;
cin>>j;
if(i==j)
{set_file_c(head_c);}
}
else
{cout<<"是否在教練員文本文件中追加記錄?是按1,否按0!"<<endl;
cin>>h;
if(h){cout<<"請輸入管理員密碼"<<endl;
cin>>j;
if(i==j)
{cout<<"請輸入要追加教練員記錄的文本文件名!"<<endl;
cin>>fileName;
Append_c(head_c,fileName);
}
}
}
break;
case 0:cout<<"退出俱樂部人員管理系統"<<endl;return;
default:cout<<"輸入錯誤,請再輸入"<<endl;
}
cout<<"******************華工高爾夫俱樂部人員管理系統******************"<<endl;
cout<<"*** 請操作選擇^^ ***"<<endl;
cout<<"*** 1:初級會員 ***"<<endl;
cout<<"*** 2:高級會員 ***"<<endl;
cout<<"*** 3:教練員 ***"<<endl;
cout<<"*** 0:退出人員管理系統 ***"<<endl;
cout<<"****************************************************************"<<endl;
cin>>choice;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -