📄 main.cpp
字号:
#include <iostream>
#include <stdlib.h>
using namespace std;
struct Point3D {
double x;
double y;
double z;
};
bool operator == (Point3D &first, Point3D &second) {
return (
first.x == second.x &&
first.y == second.y &&
first.z == second.z);
}
bool ComparePoint3D(Point3D &first, Point3D &second) {
return (
first.x == second.x &&
first.y == second.y &&
first.z == second.z);
}
Point3D StartingPoint(float x) {
Point3D start;
start.x = x;
start.y = x * 2;
start.z = x * 3;
return start;
}
int main(int argc, char *argv[])
{
Point3D FirstPoint = { 10.5, 22.25, 30.8 };
Point3D SecondPoint = FirstPoint;
Point3D ThirdPoint = { 25.99, 15.2, 30.9 };
if (ComparePoint3D(FirstPoint,SecondPoint)) {
cout << "First and second are the same" << endl;
}
if (ComparePoint3D(FirstPoint, ThirdPoint)) {
cout << "First and third are the same" << endl;
}
Point3D MyPoint = StartingPoint(5.2);
Point3D OtherPoint = StartingPoint(6.5);
cout << MyPoint.x << endl;
cout << MyPoint.y << endl;
cout << MyPoint.z << endl;
cout << endl;
cout << OtherPoint.x << endl;
cout << OtherPoint.y << endl;
cout << OtherPoint.z << endl;
system("PAUSE");
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -