drt 发表于 2017-3-24 17:30:55

麻烦给位大佬看看 帮忙找一下 错误 谢谢了谢谢谢谢

#include <iostream>
#include <string.h>
using namespace std;
class complex_add
{
public:
    double real;
    double fault;
    complex_add();
    complex_add(double r,double k);
    complex_add operator + (complex_add&d);

    ~complex_add();

};
complex_add complex_add::complex_add operator+(complex_add &d)
{
    complex_add c;
    c.real=real+d.real;
    c.fault=fault+d.fault;
    return c;
}
complex_add::complex_add()
{
    real=0;
    fault=0;
}
complex_add::complex_add(double r,double k)
{
    real=r;
    fault=k;
}

complex_add::~complex_add()
{
    cout<<"Is done"<<endl;
}
int main()
{
    complex_add a(5,6),b(6,7),c;
    c=a+b;
    cout<<c.real<<" "<<c.fault<<endl;

}
这个请问为什么会有语法错误啊水货一个希望给位大神指导谢谢
是在
complex_add complex_add::complex_add operator+(complex_add &d)
{
    complex_add c;
    c.real=real+d.real;
    c.fault=fault+d.fault;
    return c;
}这里出的错误就一下谢谢了

人造人 发表于 2017-3-24 19:24:12

drt 发表于 2017-3-24 20:01:43

谢谢谢谢    但是还是不知道怎么改
还有请问你的编译器是什么呢可以看的这么仔细

drt 发表于 2017-3-24 20:09:56

drt 发表于 2017-3-24 20:01
谢谢谢谢    但是还是不知道怎么改
还有请问你的编译器是什么呢可以看的这么仔细

还有啊为什么小甲鱼的可以啊我是看了小甲鱼的视频后自己做的

人造人 发表于 2017-3-25 12:18:31

drt 发表于 2017-3-24 20:09
还有啊为什么小甲鱼的可以啊我是看了小甲鱼的视频后自己做的

vs2015

drt 发表于 2017-3-25 13:59:41

人造人 发表于 2017-3-25 12:18
vs2015

谢谢你了
页: [1]
查看完整版本: 麻烦给位大佬看看 帮忙找一下 错误 谢谢了谢谢谢谢