上記のエラーが発生します。私はCでコーディングし、標準のgccコンパイラ(コマンドウィンドウ)を使用しています。これが私のコードの問題のある部分です。エラーは見られません。おそらく私の目は同じものを見るのにうんざりしています。
LEADER *call_leader(double st1, double st2, double incentive, double pdis)
{
LEADER *leader= (LEADER *)malloc(sizeof(LEADER));
double shortest = MIN(st1, st2) ; //shortest station
if (shortest == st1 && s1 != 0){ //no congestion
leader->price1 = p_max;
leader->price2 = p_max;
}
if (shortest == st2 && s2 != 0){ //no congestion
leader->price1 = p_max;
leader->price2 = p_max;
}
if (shortest == st1 && s1 == 0){ //congestion at station 1
if (s2 != 0){ // no congestion at station 2, try to route
leader->price1 = p_max;
double cost_1 = shortest*pdrive + p_max;
double p2 = cost1 - st2*pdrive - (sqrt(pow((st2 - st1),2)))*pdis - incentive;
if (p2 >= p_min){
leader->price2 = p2;
}else{
leader->price2 = p_min;
}
}
else if (s2 == 0){
if (r1 >= r2){ // st1 less congestion
leader-> price1 = p_max;
}
Problematic Line => else (r1 < r2) { //try to route s2
leader -> price1 = p_max;
double cost_1 = shortest*pdrive + p_max;
double p2 = cost1 - st2*pdrive - (sqrt(pow((st2 - st1),2)))*pdis - incentive;
if (p2 >= p_min){
leader->price2 = p2;
}
else{
leader->price2 = p_min;
}
}
}
}