为什么编译时说xi和yi都是未说明的标识符,#includeusing namespace std;class imaginary{public:\x05 imaginary(double a,double b)\x05 {\x05\x05 x=a;\x05\x05 y=b;\x05 }\x05 friend imaginary add(imaginary &i1,imaginary &i2);\x05 friend imagi

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/26 03:48:42
为什么编译时说xi和yi都是未说明的标识符,#includeusingnamespacestd;classimaginary{public:\x05imaginary(doublea,doubleb)

为什么编译时说xi和yi都是未说明的标识符,#includeusing namespace std;class imaginary{public:\x05 imaginary(double a,double b)\x05 {\x05\x05 x=a;\x05\x05 y=b;\x05 }\x05 friend imaginary add(imaginary &i1,imaginary &i2);\x05 friend imagi
为什么编译时说xi和yi都是未说明的标识符,
#include
using namespace std;
class imaginary
{
public:
\x05 imaginary(double a,double b)
\x05 {
\x05\x05 x=a;
\x05\x05 y=b;
\x05 }
\x05 friend imaginary add(imaginary &i1,imaginary &i2);
\x05 friend imaginary sub(imaginary &i1,imaginary &i2);
\x05 friend imaginary mul(imaginary &i1,imaginary &i2);
\x05 friend imaginary dev(imaginary &i1,imaginary &i2);
\x05 void show();
private:
\x05 double x,y,xi,yi;
};
imaginary add(imaginary &i1,imaginary &i2)
\x05 {
\x05\x05 i1.xi =i1.x+i2.x;
\x05\x05 i1.yi =i2.y+i1.y;
return i1;
\x05 }
\x05 imaginary sub(imaginary &i1,imaginary &i2)
\x05 {
\x05\x05 i1.xi=i1.x-i2.x;
\x05\x05 i1.yi=i1.y-i2.y;
\x05return i1;
\x05 }
\x05 imaginary mul(imaginary &i1,imaginary &i2)
\x05 {
\x05\x05 i1.xi=i1.x*i2.x-i1.y*i2.y;
\x05\x05 i1.yi=i1.x*i2.y+i1.y*i2.x;
\x05return i1;
\x05 }
\x05 imaginary dev(imaginary &i1,imaginary &i2)
\x05 {
\x05\x05 i1.xi=(i1.x*i2.x+i1.y*i2.y)/(i2.x*i2.x+i2.y*i2.y);
\x05\x05 i1.yi=(i1.y*i2.x-i1.x*i2.y)/(i2.x*i2.x+i2.y*i2.y);
return i1;
\x05 }
\x05 void show(){
\x05 if(yi

为什么编译时说xi和yi都是未说明的标识符,#includeusing namespace std;class imaginary{public:\x05 imaginary(double a,double b)\x05 {\x05\x05 x=a;\x05\x05 y=b;\x05 }\x05 friend imaginary add(imaginary &i1,imaginary &i2);\x05 friend imagi
将void show(){
\x05 if(yi