Parse Error At The End Of Input C
Programming Boards C++ Programming Parse error at end of input?? Getting started with C or C++ | C Tutorial | C++ Tutorial | C and C++ FAQ | Get
Syntax Error At The End Of Input C
a compiler | Fixes for common problems Thread: Parse error at end of input?? syntax error at end of input postgresql Thread Tools Show Printable Version Email this Page… Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode 06-05-2002 #1 erikcn View Profile View Forum Posts Visit Homepage Registered User Join Date May 2002 Posts 23 Parse error at end of input?? Hi. I'm compiling with Dev C++ 4.0 Compiler. When compiling the code below i get a parse error at end of input.. Its at line 50. And theres no code on line 50. If i write code at line 50, then the error occurs at line 51. Please Help! Code: #include #include using namespace std; int main () { int money; int ihave; int lost; cout << "Hur mycket pengar har du?" << endl; cin>>ihave; cout << "Hur mycket pengar har du tjänat den här månaden?" << endl; cin>>money; cout << "Hur mycket pengar har du förlorat den här månaden?" << endl; cin>>lost; ihave+=money; ihave-=lost; if (ihave<=0) { cout << "KONKURS! KONKURS! KONKURS!" << endl; Sleep(2000); return 0; } else { cout << "Så här mycket pengar har du nu!" << endl; cout << ihave << endl; Sleep(2000); return 0; } .. zzz soooo tireed. 06-05-2002 #2 Monster View Profile View Forum Posts Me want cookie! Join Date Dec 2001 Posts 680 Is it because you forgot the } at the end of else ??? 06-05-2002 #3 erikcn View Profile View Forum Posts Visit Homepage Registered User Join Date May 2002 Posts 23 uhhmmm... No No return 0; is included in else. .. zzz soooo tireed. 06-05-2002 #4 Flikm View Profile View Forum Posts Registered User Join Date Sep 2001 Posts 305 mismatched braces, add another '}' to the end. 06-05-2002 #5 jdinger View Profile View Forum Posts Visit Homepage Used Registerer Join Date Feb 2002 Posts 1,065 Re: uhhmmm... Originally posted by erikcn No No return 0; is included in else. Then you have a never ending int main(), because you're still missing an ending brace } to close the main. Quick Navigation C++ Programming T
Programming Boards C Programming Syntax error at end of input Getting started with C or C++ | C Tutorial | C++ Tutorial | C and C++ FAQ | Get a compiler | Fixes for common problems Thread: Syntax error at end of input Thread Tools Show Printable Version Email this Page… Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode 06-16-2009 #1 implor View Profile View Forum Posts Registered User Join Date Jun 2009 http://cboard.cprogramming.com/cplusplus-programming/19181-parse-error-end-input.html Posts 7 Syntax error at end of input I'm getting a "Syntax error at end of input" (last line). but i can't find what's wrong. Code: int main() { int ett; FILE *filen; int val; char filnamn[40]; enum filtyp {db,txt,bin}; typedef enum filtyp filtyp; printf("Skriv filnamn: "); scanf("%s", &filnamn); int i = 0; while( filnamn[i] != '.') { i++; } if(filnamn[i+1] http://cboard.cprogramming.com/c-programming/116886-syntax-error-end-input.html == 't' || filnamn[i+1] == 'T' ) { if((filen = fopen(filnamn, "r")) == NULL) { printf("file don't exist"); exit(1); } binary = 0; } else if (filnamn[i+1] == 'b' || filnamn[i+1] == 'B') { if((filen = fopen(filnamn, "rb")) == NULL) { printf("file don't exist"); exit(1); } binary = 1; } readfil(filen); meny(); close(filen); return 0; } 06-16-2009 #2 Sebastiani View Profile View Forum Posts Guest Join Date Aug 2001 Location Waterloo, Texas Posts 5,708 Well, if you would indent your code properly, you'd see the missing brace... Example: Code: int main( void ) { if( condition ) { foo( ); } else if( some_other_condition ) { while( true ) { bar( ); } } } Or maybe: Code: int main( void ) { if( condition ) { foo( ); } else if( some_other_condition ) { while( true ) { bar( ); } } } Code: #include #include bool euler_flip(bool value) { return std::pow ( std::complex(std::exp(1.0)), std::complex(0, 1) * std::complex(std::atan(1.0) *(1 << (value + 2))) ).real() < 0; } 06-16-2009 #3 dwks View Profile View Forum Posts Visit Homepage Frequently
Forums >Programming >C/C++ Help Syntax errors - Parse error at end of input Discuss Parse error at end of input in the C/C++ Help forum on Dev Articles. Parse error at end of input C/C++ Help forum discussing building and maintaining applications in C/C++. Find http://forums.devarticles.com/c-c-help-52/parse-error-at-end-of-input-193307.html out why these languages are the foundation on which other languages are built. Add This https://bytes.com/topic/c/answers/218273-parse-error Thread To: Del.icio.us Digg Google Spurl Blink Furl Simpy Y! MyWeb « Previous Thread | Next Thread » Thread Tools Search this Thread Display Modes Dev Articles Community Forums Sponsor: #1 April 19th, 2009, 04:35 AM mister.box82 Registered User Join Date: Apr 2009 Posts: 1 error at Time spent in forums: 13 m 59 sec Reputation Power: 0 Syntax errors - Parse error at end of input Hi, I have a problem, I'm trying to write a program , [.c] , this prgram converts the capital letter in normal letter, but the program gives me these 2 error: in function main parse error at the end of input please help me..!!! this is the program: #include #include #include int main(void) { char end of input testo[100]; int i; printf("digitare il testo: "); fgets(testo, 100, stdin); for(i = 0; testo[i]; i++) { if (islower(testo[i])) testo[i] = toupper(testo[i]); else if (isupper(testo[i])) testo[i] = tolower(testo[i]); printf("testo convertito: %s\n", testo); return 0; mister.box82 View Public Profile View Extended RPG Stats Challenge This User To Battle Send a private message to mister.box82 Find all posts by mister.box82 Find all threads by mister.box82 Add mister.box82 to Your Buddy List #2 April 20th, 2009, 02:44 AM lampshade Registered User Join Date: Apr 2009 Posts: 3 Time spent in forums: 1 h 25 m 2 sec Reputation Power: 0 If you didnt already figure it out, your missing a closing curly brace '}' for the main routine. Code: #include #include #include #define ARRY_SZ 100 // avoiding varaible declaration int main( int argc, char **argv ) { char testo[ARRY_SZ] = {}; int i = 0; printf("digitare il testo: "); fgets(testo, ARRY_SZ, stdin); for i = 0; testo[i]; i++) { // if the for was without curly braces // this if would be the only statement effected. if (islower(testo[i])) testo[i] = toupper(testo[i]); else if (isupper(testo[i])) testo[i] = tolower(testo[i]); } printf("testo convertito: %s\n", testo); return 0; } lampshade View Public Profile View Extended RPG Stats Challenge This User To Battle Send a private message to lampshade Find all posts by lampshade Find all threads by lampshade Add lampshade to Your
solutions from a community of 418,616 IT Pros & Developers. It's quick & easy. parse error P: n/a John Hanley I just received a "parse error at end of input" when compiling my code, but am unsure why. It lists the line as the very last line of my .c file "}"My code compiled fine yesterday, and I only made some minor adjustments today. I am using the DJGPP compiler. Is this parse error indicative of anything particular? Ideas? Thanks again! John Nov 14 '05 #1 Post Reply Share this Question 5 Replies P: n/a Mark A. Odell "John Hanley" wrote in news:10***************@proxy2.srv.ualberta.ca: I just received a "parse error at end of input" when compiling my code, but am unsure why. It lists the line as the very last line of my .c file "}"My code compiled fine yesterday, and I only made some minor adjustments today. I am using the DJGPP compiler. Is this parse error indicative of anything particular? Ideas? Sure, give us something to look at (we can't read minds) or start "cutting out" large chunks of the file with #if / #endif until the error goes away. Then move back out until you find the problem. Of course you need to be smart about placement of the if/endif directives. -- - Mark -> -- Nov 14 '05 #2 P: n/a Bill Potter Some times it happends that one may add a { and not close it} like that "John Hanley" wrote in message news:10***************@proxy2.srv.ualberta.ca... I just received a "parse error at end of input" when compiling my code, but am unsure why. It lists the line as the very last line of my .c file "}"My code compiled fine yesterday, and I only made some minor adjustments today. I am using the DJGPP compiler. Is this parse error indicative of anything particular? Ideas? Thanks again! John Nov 14 '05 #3 P: n/a Ben Pfaff "John Hanley" writes: I just received a "parse error at end of input" when compiling my code, but am unsure why. It lists the line as the very last line of my .c file "}"My code compiled fine yesterday, and I only made some minor adjustments today. This may indicate that you began more blocks with { than you closed with }. -- Ben Pfaff email: bl*@cs.stanford.edu web: http://benpfaff.org Nov 14 '05 #4 P: n/a John Hanley > Some times it happends that one may add a { and not close it} like that I found the problem. It makes sense that it was a parse error because it was one "}" short. However, it was somewhere in the middle of my co