注册 登录
编程论坛 C++教室

简单的类,为什么输出是乱码

arieswjw 发布于 2012-06-14 19:27, 363 次点击
#include<iostream>
#include<cstring>
using namespace std;
class Account
{   

private:
    char name[20];
    char number[20];
    double money;
public:
    void  show(void) ;////////////////
Account(char a[20]="q1",char b[20]="sds",double c=0)
{};//////////////////////

};

int main()
{

   
    Account c("ng","an",10000);
    c.show();
    return 0;
}
void Account::show(void)
{

    cout<<"name:"<<name<<endl;
    cout<<number<<endl;
    cout<<money<<endl;

}
1 回复
#2
chenshigai2012-06-14 20:20
你定义的构造函数没用啊!
1