0
我看了其他線程,他們說「這或那不是一個指針!!!」我真的不知道這意味着什麼,我已經聲明瞭所以什麼不在這裏工作?我們正在編寫一個程序來查找一個方形btw的區域,這也不是整個代碼!第2行也是錯誤點。CS2064「術語不考慮帶1個參數的函數」?
int s = ((line_one + line_two + line_three)/2);
int area = sqrt((s - line_one)(s - line_two)(s - line_three));
cout << "The area of the triange is..." << area << endl;
此處,我聲明其他變量:
// Area of a Triangle
double x1 = 0;
double y1 = 0;
double x2 = 0;
double y2 = 0;
double x3 = 0;
double y3 = 0;
double x4 = 0;
double y4 = 0;
double x5 = 0;
double y5 = 0;
double x6 = 0;
double y6 = 0;
//line one points
cout << "enter point x1" << endl;
cin >> x1;
cout << "enter point y1" << endl;
cin >> y1;
cout << "enter point x2" << endl;
cin >> x2;
cout << "enter point y2" << endl;
cin >> y2;
const int line_one = sqrt((pow((x2 - x1), 2) + (pow((y2 - y1), 2))));
//line two points
cout << "enter point x3" << endl;
cin >> x3;
cout << "enter point y3" << endl;
cin >> y3;
cout << "enter point x4" << endl;
cin >> x4;
cout << "enter point y4" << endl;
cin >> y4;
const int line_two = sqrt((pow((x4 - x3), 2) + (pow((y4 - y3), 2))));
//line three points
cout << "enter point x5" << endl;
cin >> x5;
cout << "enter point y5" << endl;
cin >> y5;
cout << "enter point x6" << endl;
cin >> x6;
cout << "enter point y6" << endl;
cin >> y6;
const int line_three = sqrt((pow((x6 - x5), 2) + (pow((y6 - y5), 2))));
//Calculating the Area
int s = ((line_one + line_two + line_three)/2);
int area = sqrt((s - line_one)(s - line_two)(s - line_three));
cout << "The area of the triange is..." << area << endl;
return 0;
}
請顯示所有變量和#includes等的聲明請參見[ask] – OldProgrammer
'((s-line_one)(s-line_two)(s-line_three))'產生了什麼?假設其餘的是數字數據類型,那麼這是試圖做一個函數調用..你的意思是乘以這三個'((s-line_one)*(s-line_two)*(s-line_three))'? – txtechhelp
'(s - line_one)(s - line_two)(s - line_three)'是絕對錯誤的。你需要括號內的*號 – Varius