int main ( int argc, char *argv[] )
{
        const int numinputs = 7;

        if ( argc != numinputs+1 ) {
		std::cout << "Error: " << argc-1 << " inputs given, " << numinputs << " required." << std::endl;
		std::cout << "Usage: OptionPrice_cmdline N T u d p S0 K" << std::endl;
                exit(1);
        }

	int N;
	double T,u,d,p,S0,K;

        N = atoi(argv[1]);
        T = atof(argv[2]);
        u = atof(argv[3]);
        d = atof(argv[4]);
        p = atof(argv[5]);
        S0 = atof(argv[6]);
        K = atof(argv[7]);

        double a = OptionPrice(N,T,u,d,p,S0,K);

	std::cout << "The Option Price is: " << a << std::endl;

        return EXIT_SUCCESS;
}
LPXLOPER EXCEL_EXPORT
xlOptionPrice(
LPXLOPER requested_fielda,
LPXLOPER model_ida,
LPXLOPER option_ida,
LPXLOPER method_ida)
{
EXCEL_BEGIN;

	if (XlfExcel::Instance().IsCalledByFuncWiz())
		return XlfOper(true);

XlfOper requested_fieldb(
	(requested_fielda));
std::string requested_field(
	requested_fieldb.AsString("requested_field"));

XlfOper model_idb(
	(model_ida));
std::string model_id(
	model_idb.AsString("model_id"));

XlfOper option_idb(
	(option_ida));
std::string option_id(
	option_idb.AsString("option_id"));

XlfOper method_idb(
	(method_ida));
std::string method_id(
	method_idb.AsString("method_id"));

CellMatrix result(
	OptionPrice(
		requested_field,
		model_id,
		option_id,
		method_id)
	);
return XlfOper(result);
EXCEL_END
}