#include <bits/stdc++.h> using namespace std; struct card{ //属性 string name; int id; string classroom; float money; int money_type;//0人民币 1美元 2 泰铢 string creat_time; string tellphone; string creat_date; //方法 //开卡 bool creat(int i,string n,string c){ name=n; id=i; classroom=c; return true; } //充钱 bool Recharge(int m){ money+=m; } //消费 bool consumption(int m){ if(money>=m && m>0){ money-=m; return true; } return false; } }; int main(){ card cardlist[100]; int startid=1000; int number=0;//当前有几个人办卡 while(1){ cout<<"***太康一高附属学校充值系统***"<<endl; cout<<"1.开卡"<<endl<<"2.充值"<<endl<<"3.消费"<<endl<<"4.查询余额"<<endl; cout<<"5.挂失"<<endl<<"6.退钱"<<endl<<"7.退出系统"; cout<<endl; int index; cin>>index; card c; switch(index){ case 1: cout<<"请输入姓名:"; cin>>c.name; c.id=startid+number; cardlist[number]=c; cout<<"办卡成功!,你的卡号为"<<c.id<<endl; number++; break; case 2: cout<<"请输入你的卡号:"<<endl; int _cid; cin>>_cid; bool have=false; for(int i=0;i<=number;i++){ if(cardlist[i].id==_cid){ cout<<cardlist[i].name<<"同学你好,请输入充值金额:"; int c_money; cin>>c_money; c.money+=c_money; cout<<"充卡成功!目前你的卡里拥有"<<c.money<<"元"<<endl; have=true; break; } } if(have==false){ cout<<"对不起,该同学没有创建卡号"<<endl; } break; case 3: break; /*case 4: cout<<"请输入你的卡号:"<<endl; int c_Id; cin>>c_Id; bool Have=false; for(int i=0;i<=number;i++){ if(cardlist[i].id==c_Id){ cout<<cardlist[i].name<<"同学你好,你的余额为:"<<c.money<<"元"<<endl; Have=true; break; } } if(Have==false){ cout<<"对不起,该同学没有创建卡号"<<endl; } */ } return 0; } }
标签:false,string,int,money,系统,bool,cout From: https://www.cnblogs.com/fushuxuan/p/17841666.html