嘿伙计们我是c +的新手,每次编译我的代码时都会说我在一个很好的行上有一个错误c2413,但我显然有一个半冒号.每当我输入ex等内容时,通常会发生这种情况.Complex.real.我想知道你是否可以帮助我?
using namespace std;
#include <iostream>
class Complex
{
private:
double real;
double imaginary;
public:
Complex()
{
real = 0.0;
imaginary = 0.0;
}
Complex(double r, double i)
{
real = r;
imaginary= i;
}
//Setters
void setReal(double r)
{
real = r;
}
void setImaginary(double i)
{
imaginary = i;
}
//Getters
double getReal()
{
return real;
}// end getReal
double getImaginary()
{
return imaginary;
}//end of getImaginary()
void output()
{
cout<< real <<" + i"<< imaginary;
} …Run Code Online (Sandbox Code Playgroud)