📄 test7.2_3dpointtest.cpp
字号:
/*#include<iostream>
using namespace std;
class point
{
double x,y,z;
public:
point()
{
x=y=z=0;
}
point(double x,double y,double z)
{
this->x=x;
this->y=y;
this->z=z;
}
point operator+(point &p)
{
point temp(x+p.x,y+p.y,z+p.z);
return temp;
}
point operator-(point &p)
{
point temp(x-p.x,y-p.y,z-p.z);
return temp;
}
point operator=(point &p)
{
point temp((x=p.x),(y=p.y),(z=p.z));
return temp;
}
static void show(point &p)
{
cout<<"("<<p.x<<","<<p.y<<","<<p.z<<")"<<endl;
}
};
void main()
{
point p1(1.1,2.2,3.3),p2(4.4,5.5,6.6),total,difference,evaluate;
total=p1+p2;
cout<<"点p1 ";
point::show(p1);
cout<<"与点p2 ";
point::show(p2);
cout<<"之和是:";
point::show(total);
difference=p1-p2;
cout<<"点p1 ";
point::show(p1);
cout<<"与点p2 ";
point::show(p2);
cout<<"之差是:";
point::show(difference);
evaluate=p1;
cout<<"点p1 ";
point::show(p1);
cout<<"赋值给点evaluate(0,0,0)结果是: ";
point::show(evaluate);
}*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -