[表示 : 全て 最新50 1-99 101- 201- 301- 2chのread.cgiへ]
Update time : 02/14 10:29 / Filesize : 83 KB / Number-of Response : 315
[このスレッドの書き込みを削除する]
[+板 最近立ったスレ&熱いスレ一覧 : +板 最近立ったスレ/記者別一覧] [類似スレッド一覧]


↑キャッシュ検索、類似スレ動作を修正しました、ご迷惑をお掛けしました

【初心者歓迎】C/C++室 Ver.58【環境依存OK】



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]をどこかで使えばいいのでしょうか。






[ 続きを読む ] / [ 携帯版 ]

全部読む 前100 次100 最新50 [ このスレをブックマーク! 携帯に送る ] 2chのread.cgiへ
[+板 最近立ったスレ&熱いスレ一覧 : +板 最近立ったスレ/記者別一覧](*・∀・)<83KB

read.cgi ver5.27 [feat.BBS2 +1.6] / e.0.2 (02/09/03) / eucaly.net products.
担当:undef