我想輸入三角形的頂點並找到三角形的區域。我讀了頂點並試圖打印它。但它顯示錯誤。你能幫我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