我想输入三角形的顶点并找到三角形的区域。我读了顶点并试图打印它。但它显示错误。你能帮我out.I尝试以下结构数组有什么问题?
#include <iostream>
#include <math.h>
using namespace std;
struct vertex {
float x;
float y;
};
struct triangle {
vertex vertices[3];
};
int main()
{
triangle t;
for (int i = 0; i < 3; ++i) {
double x, y;
cin >> x >> y;
vertex p = { x, y };
cout << p;
t.vertices[i] = p;
// cout<<t.x;
}
}
你能告诉我们错误吗? – Stefan
错误在cout << p line.wat的错误 – user3217708
不;显示错误。它说什么? – Stefan