#include <bits/stdc++.h> using namespace std; struct CARD{ //ATTRIBUTE: string NAME; int ID; string CLASSROOM; float MONEY; int MONER_TYPE; string COST_TIME; string PHONEID; bool CREAT(int i,string n,string c){ NAME=n; CLASSROOM=c; ID=i; return true; } //充钱 bool Recharge(int m){ MONEY+=m; return true; } //消费 bool consumption(int m){ if(MONEY>=m && m>0){ MONEY-=m; return true; } return false; } }; int main(){ CARD CARDLIST[100]; int STRATID=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 LNDEX; cin>>LNDEX; CARD c; switch(LNDEX){ case 1: cout<<"请输入姓名:"; cin>>c.NAME; c.ID=STRATID+NUMBER; CARDLIST[NUMBER]=c; cout<<"你的卡号:"<<c.ID; NUMBER++; break; case 2: cout<<"请输入你的卡号:"; int _CID; cin>>_CID; bool HAVE=false; for(int i=0;i<=NUMBER;i++){ if(CARDLIST[i].ID==_CID){ cout<<CARDLIST[i].NAME<<"同学你好,请输入充值金额:"; string c_MONEY; cin >> c_MONEY; c.MONEY+=c_MONEY; HAVE=true; break; } } if(HAVE==false){ cout<<"gun,s*"<<endl; } break; } } }
#include <bits/stdc++.h> using namespace std; struct CARD{ //ATTRIBUTE: string NAME; int ID; string CLASSROOM; float MONEY; int MONER_TYPE; string COST_TIME; string PHONEID; bool CREAT(int i,string n,string c){ NAME=n; CLASSROOM=c; ID=i; return true; } //充钱 bool Recharge(int m){ MONEY+=m; return true; } //消费 bool consumption(int m){ if(MONEY>=m && m>0){ MONEY-=m; return true; } return false; } }; int main(){ CARD CARDLIST[100]; int STRATID=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 LNDEX; cin>>LNDEX; CARD c; switch(LNDEX){ case 1: cout<<"请输入姓名:"; cin>>c.NAME; c.ID=STRATID+NUMBER; CARDLIST[NUMBER]=c; cout<<"你的卡号:"<<c.ID; NUMBER++; break; case 2: cout<<"请输入你的卡号:"; int _CID; cin>>_CID; bool HAVE=false; for(int i=0;i<=NUMBER;i++){ if(CARDLIST[i].ID==_CID){ cout<<CARDLIST[i].NAME<<"同学你好,请输入充值金额:"; string c_MONEY; cin >> c_MONEY; c.MONEY+=c_MONEY; HAVE=true; break; } } if(HAVE==false){ cout<<"gun,s*"<<endl; } break; } } }
标签:return,cout,int,MONEY,system,Recharging,bool,string From: https://www.cnblogs.com/hanxuyao/p/17841664.html