vip会员管理系统c语言,路西牌会员管理系统。
該樓層疑似違規已被系統折疊?隱藏此樓查看此樓
void VIP::show( Node *v)
{
no(v);
char *a=VIP::sex(v);
std::cout<
<< "會員姓名: "<< node.item.num[1]<< endl
<< "性別: "<< sex(v)<
<< "手機號碼: "<< node.item.num[2]<< endl
<< "儲值賬戶: "<< node.item.mony<< endl
<< "積分賬戶: "<< node.item.gra<< endl<
}
VIP::Node * VIP::Find(int i)
{
int a=0;
char n[11];
char *ite;
switch(i){
case 0:ite="卡號:";break;
case 1:ite="姓名:";break;
case 2:ite="手機號碼:";break;}
cout<
cin.getline(n,10);
Node *temp=head;
while(temp!=NULL)
{
if(strstr(temp->item.num[i],n)!=NULL)
{
show(temp);
a++;
temp=temp->next;
continue;
}
else if(temp->next==NULL&&a==0)
{
cout<< "沒有這個會員,重新輸入(q 退出):"<< endl;
cin.getline(n,10);
if(!strcmp(n,"q"))
break;
temp=head;
continue;
}
temp=temp->next;
}
return NULL;
}
void VIP::Save()
{
if(!Items())
{
cout<< "沒有會員..太失敗了.."<< endl;
return ;
}
Node *v=InTheVIP();
if(v!=NULL)
{
int i;
cout<< "請輸入要儲存的金額:\n";
cin>> i;
while(getchar()!='\n');
v->item.mony += i;
show(v);
}
}
void VIP::Con()
{
if(!Items())
{
cout<< "沒有會員..太失敗了.."<< endl;
return ;
}
Node *v=InTheVIP();
if(v==NULL)return;
int i;
cout<< "請輸入要消費的金額:\n";
while(cin>> i&& i!=0)
{
while(getchar()!='\n');
if(i<=v->item.mony)
{
cout<< "請輸入密碼:";
char n[10];
while(cin >>n&&strcmp(v->item.num[3],n))
{
if(strcmp(n,"q"))
return;
cout<< "輸入錯誤,請重新輸入(q退出)";
}
v->item.mony -= i;
v->item.gra += i;
cout<< "扣款成功"<
show(v);
break;
}
else
cout<< "余額不足,請重新輸入(0 退出)"<
}
}
void VIP::showall()
{
if(!Items())
{
cout<< "沒有會員.太失敗了.."<< endl;
return;
}
printf("%-15s%-10s%-15s%-15s%-15s\n", "會員卡號", "姓名", "手機號碼", "儲值賬戶", "積分賬戶");
for(Node *temp=head;temp!=NULL;temp=temp->next)
{
printf("%-15s%-10s%-15s%-15.1f%-15.1f\n",
temp->item.num[0]
,temp->item.num[1]
,temp->item.num[2]
,temp->item.mony
,temp->item.gra);
}
}
char* VIP::sex(const VIP::Node *v)
{
return v->item.morw==1?"Man":"Woman";
}
bool VIP::Err(char *n)
{
Node *temp=head;
while(temp!=NULL)
{
if(!strcmp(temp->item.num[0],n))
{
cout<< "該會員卡號已存在,請重新輸入"<
return true;
}
else temp=temp->next;
}
return false;
}
VIP::Node * VIP::InTheVIP()
{
char n[11];
cout<
cin.getline(n,10);
Node *temp=head;
while(temp!=NULL)
{
if(strcmp(temp->item.num[0],n)==0)
{
show(temp);
return temp;
}
else if(temp->next==NULL)
{
cout<< "沒有這個會員,重新輸入或在查詢會員資料處進行模糊查找(q 退出):"<< endl;
cin.getline(n,10);
if(!strcmp(n,"q"))
break;
temp=head;
continue;
}
temp=temp->next;
}
return NULL;
}
bool VIP::ToTheFile(FILE *pf)
{
int i;
Node* temp=head;
fseek(pf,0L,SEEK_SET);
for( i=0;i
{
fseek(pf,i*sizeof(Item),SEEK_SET);
fwrite(&temp->item,sizeof(Item),1,pf);
temp=temp->next;
}
return true;
}
總結
以上是生活随笔為你收集整理的vip会员管理系统c语言,路西牌会员管理系统。的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: zip版mysql5.6_mysql 5
- 下一篇: linux挂载硬盘的分区创建,Linux