会员卡管理系统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;

}

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值