标题:怎么改进这个程序
取消只看楼主
jjg
Rank: 2
等 级:论坛游民
帖 子:67
专家分:42
注 册:2009-8-19
结帖率:46.15%
 问题点数:0 回复次数:1 
怎么改进这个程序
#include <iostream>
#include <string>
using namespace std;
class user
{
   
    double money;
    string name;
   
public:
    void add(double& mey)
    {
        money=money+mey;
        cout<<money;
    }

    user(string Name,double Money);
};
user::user(string Name,double Money)
{
    name=Name;
    money=Money;
    cout<<"please input the user's name and money:"<<name<<"  "<<money<<endl;
   
}

void main()
{
    user a("li",100);
    double mey;
    cout<<"input the number you want deposit"<<endl;
    cin>>mey;
      a.add(double& mey);//加上这句话就有错误,怎么改进实现加,且使他不出错
}
搜索更多相关主题的帖子: 改进 
2009-11-16 08:37
jjg
Rank: 2
等 级:论坛游民
帖 子:67
专家分:42
注 册:2009-8-19
得分:0 
谢谢了
2009-11-16 17:33



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-292432-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016061 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved