- 220 名前:デフォルトの名無しさん mailto:sage [2008/08/14(木) 20:03:47 ]
- #include <iostream>
using namespace std; struct Point{ double L1Point[2]; double L2Point[2]; double L1Slope; double L2Slope; double num[2]; }; double ans[2]; Point pt = {10, 20, 20, 44, 10, 3, 3, 20}; double lineIntersect(Point* pt1); int main() { *ans = lineIntersect(&pt); cout << "答えは(" << ans[0] << ',' << ans[1] << ")です\n"; return 0; } double lineIntersect(Point* pt1){ pt1->num[0] = (pt1->L1Slope * pt1->L1Point[0] - pt1->L2Slope * pt1->L2Point[0] + pt1->L2Point[1] - pt1->L1Point[1]) / (pt1->L1Slope - pt1->L2Slope); pt1->num[1] = pt1->L1Slope * (pt1->num[0] - pt1->L1Point[0]) + pt1->L1Point[1]; return pt1->num; } """"""'return' : 'double [2]' から 'double' に変換できません"""""" 構造体でやってみたのですが同じエラーが出てできません;; 自分のスキルが足りないのは百も承知ですが誰かアドバイスいただけませんか? 214さんの(double *)[2]をどこかで使えばいいのでしょうか。
|

|