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)
{    




	Montecarlo();

	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?

Recommended Answers

All 3 Replies

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

>void Montecarlo(void);
>{

What's that semicolon doing there? :)

commented: Easy money :) +22

haha wow.
thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.