How about "wots FAQ"? As in,Originally Posted by Hugo716
FAQ > Explanations of... > Definition of EOF and how to use it effectively
How about "wots FAQ"? As in,Originally Posted by Hugo716
FAQ > Explanations of... > Definition of EOF and how to use it effectively
7. It is easier to write an incorrect program than understand a correct one.
40. There are two ways to write error-free programs; only the third one works.*
hehe, thanks
EOF means end of file
putting a semi-colon after the main function is just asking for trouble.
Look at this...
in general. NEVER place a semicolon after function title implementation.Code:#include <iostream> using std::cout; using std::endl; // function prototypes void func ( void ); void funct2 ( void ); // it is ok to end function prototypes with a semi=colon int main ( void ); // this is an error { func(); // function calls end with a semi-colon return 0; cin.get(); } void func ( void ); // this is an error { func2(); } void func2 ( void ); // so is this { }
ONLY include a semi-colon after a function prototype and when you call a function
Hope this helps -pete
You'll need to understand the difference between a function DECLARATION and a function DEFINITION. A declaration simply asserts that a function exists and is ready for use.
So you can use main() although you haven't defined it's contents (although calling main() is a VERY BAD IDEA™). But to really compile your code, you'll need to define what main() does. This is the definition, which does not include the semicolon to differentiate it from a declaration:Code:int main(int, char**);
Code:int main(int n, char **v) { std::cout << "Hello World!\n"; std::cin.get(); }
Last edited by jafet; 05-26-2006 at 09:23 PM.
Code:#include <stdio.h> void J(char*a){int f,i=0,c='1';for(;a[i]!='0';++i)if(i==81){ puts(a);return;}for(;c<='9';++c){for(f=0;f<9;++f)if(a[i-i%27+i%9 /3*3+f/3*9+f%3]==c||a[i%9+f*9]==c||a[i-i%9+f]==c)goto e;a[i]=c;J(a);a[i] ='0';e:;}}int main(int c,char**v){int t=0;if(c>1){for(;v[1][ t];++t);if(t==81){J(v[1]);return 0;}}puts("sudoku [0-9]{81}");return 1;}