I am trying to fix this "error C2447: '{' : missing function header (old-style formal list?)" i looked over the program and cant find anything wrong. Here is my program.

#include <iostream>
#include <stdio.h>
#include "simpio.h"
#include "strlib.h"
#include "random.h"
using namespace std;

#define LowerLimit 0
#define UpperLimit 200
#define StepSize 20

double CelsiusToFahrenheit(double c);

int main()
{
	int c;
	
	printf("Fahrenheit     Celsius");
	for (c = LowerLimit; c <= UpperLimit; c += StepSize)
	{
		printf("%3d       %f\n", c, CelsiusToFahrenheit(c));
	}
	system("pause");
}

double CelsiusToFahrenheit(double c);
{
	return (9.0 / 5.0 * c + 32);
}
...
double CelsiusToFahrenheit(double c);
...
int main()
{
...
}

double CelsiusToFahrenheit(double c) ; // <- remove the semicolon
{
	return (9.0 / 5.0 * c + 32);
}

Thanks

Perhaps, you should have posted this question on a C++ form :-/.

And few things which I saw in your code, which you might have to consider to correcting

#include <stdio.h>
to 
#include <cstdio>

And main should return a value. Well, it’s already if you don’t specify it as well, under C99 it automatically assumes to be return 0. But it is always a good practice to place them explicitly.

system("PAUSE");

Using system function is not very portable. You might have to consider using some different function. Have a look this thread
http://www.daniweb.com/forums/thread90228.html

NOTE: I still wonder why do you consider including

#include <iostream>
and
using namespace std;

You are just mixing up languages. Did anybody guide you to do that??

ssharish

I have the same problem again but with a different program, any suggestions.

#include <iostream>
#include <stdio.h>
#include "simpio.h"
#include "strlib.h"

#define GCD();

int main()
{
	int x, y, g;

	printf("1st number = ");
	x = GetInteger();

	printf("2nd number = ");
	y = GetInteger();

	printf("The GCD of %d and %d is %d", x, y, g);
}

int GCD(int x, int y)
{
	int g;

	g = x;
	while (x % g != 0 || y % g != 0)
	{
		g--;
		}
	return (g);
}

#define GCD(); Take of that semicolon from that statment. Macros donst need a semicolon. If your marco definiation are like too big then you might use a '\' to speak it up and concatenate.

But for you just the semicolon off.

ssharish

That can't be it because i still have the same problem but get another one

Well, i could see some other problem as well now with that code. Can you please post the error message please

ssharish

I question whether you want to #define this function instead of just declaring it at the top. Try replacing

#define GCD();

with this:

int GCD(int x, int y);
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.