学校良心饭卡

#include <iostream>
using namespace std;
struct card{
	//属性 
	string name;
	int id;
	string classroom;
	float money;
	int money_type;//0人民币 1美元  2 泰铢
	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){
		
		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;
				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<<"同学你好,请输入充值金额:";
						have=true;
						break;
					} 
				} 
				if(have==false){
					cout<<"对不起,该同学没有创建卡号"<<endl;
				}
				break;		
		}
	}
	
	/*
	卡片:
		属性:
			姓名:string 张三 
			卡号:int  123456 
			班级:string 三2班 
			余额:float  0.2
			余额单位: 元 
			办卡时间:string 2023 11 19 08 40 
			手机号:string 
			办卡地点:string 充值点 
			身份证:string  
			家庭住址:string
			每日消费上限:int 50
			消费记录: string[]
			最后一次消费时间:string 
			充值记录:string[]
			挂失状态:bool  
		方法:
			开卡 参数1:姓名、班级、 
			充值 参数1:int 金额 
			刷卡 参数1:float 金额 参数2:string 地点
			挂失: 参数1 卡号
			余额查询:参数1  卡号 
			修改姓名:参数1 卡号 参数2 新名字
			删除卡片:参数1 卡号
			退钱:参数1 卡号 参数2 金额
			增加利息:参数1 卡号 参数2 金额 		 
	
	*/
	
	
	
	return 0;
}

  

posted @ 2023-11-19 09:30  最后一个还有我  阅读(21)  评论(0)    收藏  举报