#include <iostream>
#include <bits/stdc++.h>
using namespace std;
struct card{
//属性
string name;
int id;
string classroom;
float money;
int money_type;
string creat_time;
//方法
//开卡
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(int argc, char** argv) {
card cardlist[100];
int startid=1000;
int number=0;//当前有几个人办卡
while(1){
system("cls");
cout<<"**太康一高附属学校充值系统**"<<endl;
cout<<"*****1.开卡*****"<<endl;
cout<<"*****2.充值*****"<<endl;
cout<<"*****3.消费*****"<<endl;
cout<<"***4.查询余额***"<<endl;
cout<<"*****5.挂失*****"<<endl;
cout<<"*****6.退钱*****"<<endl;
cout<<"***7.退出系统***"<<endl;
cout<<endl;
int index;
cin>>index;
card c;
bool have=false;
int _cid;
switch(index){
case 1:
cout<<"请输入姓名:";
cin>>c.name;
c.id=startid+number;
cout<<"创卡成功"<<c.name<<"同学您的卡号是:"<<startid<<endl;
system("pause");
cout<<endl;
cardlist[number]=c;
number++;
startid++;
break;
case 2:
cout<<"请输入你的卡号:"<<endl;
cin>>_cid;
for(int i=0;i<=number;i++){
if(cardlist[i].id==_cid){
cout<<cardlist[i].name<<"同学你好,请输入充值金额:"<<endl;
cin>>c.money;
have=true;
break;
}
}
if(have==false){
cout<<"对不起,该同学没有创建卡号"<<endl;
}
system("pause");
cout<<endl;
break;
case 3:
cout<<"请输入你的卡号:"<<endl;
cin>>_cid;
break;
case 4:
cout<<"请输入你的卡号:"<<endl;
for(int i=0;i<=number;i++){
if(cardlist[i].id==_cid){
have=true;
break;
}
}
if(have==false){
cout<<"对不起,该同学没有创建卡号"<<endl;
}
system("pause");
cout<<c.name<<"同学您的余额还剩:"<<c.money<<endl;
}
}
return 0;
}