c++ 不要注释 题目描述 定义一个记录类型,它的每个值表示X-Y坐标上的一个点,X,Y的取值范围是0到100之间的整数。编一程序,顺时针读入一个四边形的各点a,b,c,d的X-Y值,并判断它是否能构成正方形(Zhengfangxing)、矩形(Juxing)或者其它四边形(Qita)。 输入 见上面 输出 见上面 样例 输入 复制 1 1 0 1 0 0 1 0 输出 复制 Zhengfangxing
时间: 2024-04-17 12:26:42 浏览: 141
你好!根据你的描述,我可以帮你编写一个C++程序来解决这个问题。以下是一个示例代码:
```cpp
#include <iostream>
using namespace std;
struct Point {
int x;
int y;
};
bool isSquare(Point a, Point b, Point c, Point d) {
int side1 = (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y);
int side2 = (b.x - c.x) * (b.x - c.x) + (b.y - c.y) * (b.y - c.y);
int side3 = (c.x - d.x) * (c.x - d.x) + (c.y - d.y) * (c.y - d.y);
int side4 = (d.x - a.x) * (d.x - a.x) + (d.y - a.y) * (d.y - a.y);
if (side1 == side2 && side2 == side3 && side
阅读全文