The code I have thus far is as follows:

/*-------Header (head.h)-----*/
#include <iostream>
#include <cmath>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <ctime>
using namespace std;
#include "fcn.cpp"
#include "Montecarlo.cpp"

/*-------Main Source (prog.cpp)---*/
#include "head.h"
int main (void)


	system ("pause");
    return 0;


/*-------Source file (Montecarlo.cpp)---*/
void Montecarlo(void);
	float ymax, b=4.0, MCArea, a;
	srand((unsigned int) time(NULL));
	ymax= fcn(b);
	MCArea = Select(b,ymax,a);
	cout << "\nThe area is approximately..."<<MCArea<<endl;
	cout << ymax << " is upper limit." <<endl;
}//end montecarlo

/*---------Source file (fcn.cpp)----*/
float fcn(float x)
    float y;

    cout << "The x value of the f(x) is:  "<< x << endl;

    y = (3.0*pow(x,2) + 2.0*x + 1.0);

    cout << "The y value y=f(x) is:  "<< y << endl;

    return y;
} /* end fcn */


There is also a resource file which was provided to me so I know it does not have problems within itself but it is called (Select.obj).

Every time I try to build the program I get the error I listed above (error C2447: '{' : missing function header (old-style formal list?)) and I have no idea why.

How can I resolve this error?

9 Years
Discussion Span
Last Post by brezzler89

Oh and the error is occuring in the line with the first bracket in Montecarlo.cpp.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.