Switch-biu
2022-07-02 20:30
采纳率: 100%
浏览 37

c++类方面的定义问题,系统warning

问题遇到的现象和发生背景

类的问题

问题相关代码,请勿粘贴截图
#include <iostream>
#include <string.h>
using namespace std;
int ww = 0;
//声明电话卡类
class CPhoneCard
{
public:
    CPhoneCard(string name1,int m_card_id1,string national_id1,string sex1,string address1,int age1,int charge1);
    void Info_show();
    Hua_fei(int m);
private:
    string name;
    int m_card_id;
    string national_id;
    string sex;
    string address;
    int age;
    int charge;

};
CPhoneCard::CPhoneCard(string name1,int m_card_id1,string national_id1,string sex1,string address1,int age1,int charge1)
{
    name=name1;
    m_card_id=m_card_id1;
    national_id=national_id1;
    sex=sex1;
    address=address1;
    age=age1;
    charge=charge1;
}
void CPhoneCard::Info_show()
{
    cout<<"姓名:"<<name<<endl;
    cout<<"电话号码:"<<m_card_id<<endl;
    cout<<"身份证号:"<<national_id<<endl;
    cout<<"性别:"<<sex<<endl;
    cout<<"年龄:"<<age<<endl;
    cout<<"家庭住址:"<<address<<endl;
    cout<<"话费余额:"<<charge<<endl;
}

int main()
{
    CPhoneCard account1("Lilei",18888888888,"11010820050626989X","Male","辽宁省大连市大连海事大学",18,120);   // 账户1
    CPhoneCard account2("HanMeimei",17777777777,"110108200206267927","Female","辽宁省大连市大连海事大学",20,120);    // 账户2
    cout << endl << "*************** 账户1个人信息 ***************" << endl;
    account1.Info_show();
    cout << endl << "*************** 账户2个人信息 ***************" << endl;
    account2.Info_show();
    cout <<endl<<"************* 账户1更换电话号码 *************" << endl;
    
    return 0;
}

运行结果及报错内容

img

我的解答思路和尝试过的方法
我想要达到的结果

系统显示隐式常量溢出,但是不太懂问题出在哪里

2条回答 默认 最新

相关推荐 更多相似问题