作业帮 > 综合 > 作业

为什么编译时说xi和yi都是未说明的标识符,

来源:学生作业帮 编辑:神马作文网作业帮 分类:综合作业 时间:2024/11/13 10:16:15
为什么编译时说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都是未说明的标识符,
将void show(){
\x05 if(yi