Hey guys, i am almost complete my program, i just keep getting the same
Error 1 error C2059: syntax error : '{'
Error 2 error C2334: unexpected token(s) preceding '{'; skipping apparent function body
//My program is
i am using visual studios 2010Code:#pragma endregion private: System::Void btncalculate_Click(System::Object^ sender, System::EventArgs^ e) { } { //Declaring Variables // The cumulative normal distribution function double CND; //Defining Variable x = Convert::ToDouble(tbStrike_Price->Text); double L; double K; double const a1 = 0.31938153, a2 = -0.356563782; double const a3 = 1.781477937; double const a4 = -1.821255978, a5 = 1.330274429; double const Pi 3.141592653589793238462643; L = fabs(X); K = 1.0 / (1.0 + 0.2316419 * L); CND = 1.0 - 1.0 / sqrt(2 * Pi) * exp(-L *L / 2) * (a1 * K + a2 * K *K + a3 * pow(K,3) + a4 * pow(K,4) + a5 * pow(K,5)); if (X < 0 )( CND= 1.0 - CND ) return CND; //Time Difference // Declare two variables System::TimeSpan daysdiff; double daysdiff = this->dtpExpiration_Date->Value - this->dtpCurrent_Date->Value;; tbDays_To_Expiration->Text = daysdiff.ToString(); // The Black and Scholes (1973) Stock option formula //Declaring Variables double call; double put; double S; double t; double r; double v; double d1; double d2; //Defining Variables s = Convert::ToDouble(tbStock_Price->Text); t = ((double daysdiff)/365); r = (Convert::ToDouble(tbRisk_Free_Rate->Text)/100); v = (Convert::ToDouble(tbVolatility->Text)/100); d1 = (Log(S / X) + (r + v ^ 2 / 2) * T) / (v * Sqr(T)); d2 = d1 - v * Sqr(T); call = S * CND(d1) - X * Exp(-r * T) * CND(d2); put = X * Exp(-r * T) * CND(-d2) - S * CND(-d1); tbCall_Price->Text = Convert::ToString(call.ToString((".00")); tbPut_Price->Text = Convert::ToString(put.ToString(".00"); } }; }



LinkBack URL
About LinkBacks


