第2個program
for (i=0 ; i<a ; i++)
{
for (h=0; h<a ; i++)
{
呢度係唔係打錯野,,第二個for loop係無限loop
if ((temp_min_call+temp_min_put) < min_sum)
{
min_sum = (temp_min_call+temp_min_put);
min_call = temp_min_call;
min_i_call = i;
min_put = temp_min_put;
min_h_put = h;
}
}
}
}
cout << "Volatility fixed number Merton's model: " << temp_call_1[min_i_call].vol << endl;
cout << "Jump number: " << temp_call_1[min_i_call].jump_num << endl;
cout << "Jump size: " << temp_call_1[min_i_call].jump_size << endl;
cout << "Standard deviation of normal distribution: " << temp_call_1[min_i_call].sd << endl;
cout << endl;
cout << "Merton's European call price 1: " << temp_call_1[min_i_call].price << endl;
cout << "Merton's European call price 2: " << temp_call_2[min_i_call].price << endl;
cout << "Merton's European call price 3: " << temp_call_3[min_i_call].price << endl;
cout << "Merton's European call price 4: " << temp_call_4[min_i_call].price << endl;
如果上面個for loop裡面既if condition satisfy唔到,,min_i_call究竟係幾多呢,,個variable無initialize到