首页 > 其他分享 >Recharging system

Recharging system

时间:2023-11-19 10:11:23浏览次数:22  
标签:return cout int MONEY system Recharging bool string

#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

相关文章

  • mysql数据库ERROR 1193 (HY000): Unknown system variable 'validate_password_policy
    一、概况  平时我们安装完数据库,需要进行对应的密码或者密码策略修改,此时需要mysql的密码验证插件。MySQL可能没有这个插件,就需要进行相应的处理。二、问题描述mysql>setglobalvalidate_password_policy=0;ERROR1193(HY000):Unknownsystemvariable'validate_passw......
  • PETS - Public English Test System
    PETS全国公共英语等级考试PublicEnglishTestSystem,是一个向社会全方位开放的考试体系,是由教育部考试中心设计、开发的。考生不受职业、年龄和学历背景等方面限制,均可参加。根据自己的实际英语水平和工作需要来选择相应的考试级别。按规定,考生一次只能参加一个级别的考试。此外......
  • 必须为接口 System.Collections.IComparer 实现
    C#codes:publicclassDateComparer:IComparer{publicintCompare(objectx,objecty){if((xasRadDate).Date<(yasRadDate).Date){return-1;}elseif(......
  • systemctl mask firewalld
    systemctlmaskfirewalldsystemctl--helpmaskNAME...MaskoneormoreunitsunmaskNAME...Unmaskoneormoreunits[root@hecs-98663~]#systemctlstatusfirewalld●firewalld.service-firewalld-dynamicfirewall......
  • subject organization is not system:nodes 问题解决
    在下面的issues找到了答案:https://github.com/kubernetes/kubernetes/issues/99504┌──[[email protected]]-[~]└─$kubectlgetcsrNAMEAGESIGNERNAMEREQUESTORREQU......
  • mkfs.xfs报错 mkfs.xfs: /dev/new/new_box appears to contain an existing fil
    在设置逻辑卷文件类型时候报错mkfs.xfs:/dev/new/new_boxappearstocontainanexistingfilesystem(ext4).mkfs.xfs:Usethe-foptiontoforceoverwrite.上面是说目标分区,已经存在一个文件系统但是我们有很需要他更改文件系统的话就加一个-f选项[root@server~]......
  • docker system prune -a
    dockersystemprune-a  docker system prune -a 是一个Docker命令,用于清理Docker系统中未使用的镜像、容器、网络和数据卷等资源。这个命令会删除所有未被使用的资源,包括未被使用的...TRANSLATEwithxEnglishArabicHebrewPolishBulgarianHindi......
  • 随笔-Centos7 install systemtap
    SystemTapBeginnersGuideChapter2.UsingSystemTapThischapterinstructsusershowtoinstallSystemTap,andprovidesanintroductiononhowtorunSystemTapscripts.2.1.InstallationandSetupTodeploySystemTap,SystemTappackagesalongwiththeco......
  • oracle aud$造成system爆满问题
    我的数据库并没有开启对象审计,只有一些语句和权限的审计selectcount(*),usernamefromdba_audit_trailgroupbyusername;388"LIONIRPT"101062"YGLCUSR"57"APP_USR"2612712"PROM_MONITOR"1010"WALLET"4078"......
  • A Protection Measure-the river chief system
    Theriverandlakechiefsystem,namelytheriverchiefsystem,isanecologicalcivilizationconstructionsysteminnovationinwhichthepartyandgovernmentleadersatalllevelsserveasriverandlakechiefsandareresponsiblefororganizingandlead......