| | |
error C2447: '{' : missing function header (old-style formal list?)
Thread Solved |
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.
C Syntax (Toggle Plain Text)
#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); }
•
•
Join Date: Nov 2007
Posts: 978
Reputation:
Solved Threads: 208
...
double CelsiusToFahrenheit(double c);
...
int main()
{
...
}
double CelsiusToFahrenheit(double c) ; // <- remove the semicolon
{
return (9.0 / 5.0 * c + 32);
} 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
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.
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
You are just mixing up languages. Did anybody guide you to do that??
ssharish
. And few things which I saw in your code, which you might have to consider to correcting
C++ Syntax (Toggle Plain Text)
#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.
C++ Syntax (Toggle Plain Text)
system("PAUSE");
http://www.daniweb.com/forums/thread90228.html
NOTE: I still wonder why do you consider including
C++ Syntax (Toggle Plain Text)
#include <iostream> and using namespace std;
ssharish
I have the same problem again but with a different program, any suggestions.
C Syntax (Toggle Plain Text)
#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); }
_________________________
||||||||||[][][]|||||||||||||||||||
|||||||||||||||____|
||||||||||
||||||||||
||||||||||[][][]|||||||||||||||||||
|||||||||||||||____|
||||||||||
||||||||||
•
•
Join Date: Jan 2008
Posts: 3,818
Reputation:
Solved Threads: 501
I question whether you want to #define this function instead of just declaring it at the top. Try replacing
with this:
C Syntax (Toggle Plain Text)
#define GCD();
with this:
C Syntax (Toggle Plain Text)
int GCD(int x, int y);
![]() |
Similar Threads
- error C2447: '{' : missing function header (old-style formal list?) please help. (C++)
- error C2447: '{' : missing function header (old-style formal list?) (C++)
- error C2447: '{' : missing function header (old-style formal list?) (C++)
- error C2447: '{' : missing function header (old-style formal list?) (C++)
- error C2447: missing function header (old-style formal list?), what does this mean?! (C++)
Other Threads in the C Forum
- Previous Thread: Quadratic Formula
- Next Thread: shortcut to a large number of nested if-else statements
| Thread Tools | Search this Thread |
#include adobe api array arrays asterisks binarysearch calculate char cm copyanyfile copyimagefile copypdffile cprogramme creafecopyofanytypeoffileinc createcopyoffile csyntax database directory dynamic feet fflush fgets file fork forloop frequency getlasterror givemetehcodez global graphics gtkgcurlcompiling hacking hardware highest homework i/o include incrementoperators input interest kernel kilometer linked linkedlist linux linuxsegmentationfault list lists locate logical_drives loopinsideloop. match matrix meter microsoft motherboard mqqueue mysql number odf open opensource owf pattern pdf performance pointer posix probleminc process program programming pyramidusingturboccodes radix read recursion recv repetition research scanf scheduling scripting segmentationfault send sequential shape socket socketprograming stack standard string systemcall turboc unix user voidmain() wab win32api windows.h






