Parse error at end of input??

This is a discussion on Parse error at end of input?? within the C++ Programming forums, part of the General Programming Boards category; Hi. I'm compiling with Dev C++ 4.0 Compiler. When compiling the code below i get a parse error at end ...

  1. #1
    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 <windows.h>
    #include <iostream> 
    
      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.

  2. #2
    Me want cookie! Monster's Avatar
    Join Date
    Dec 2001
    Posts
    680
    Is it because you forgot the } at the end of else ???

  3. #3
    Registered User
    Join Date
    May 2002
    Posts
    23

    uhhmmm...

    No No return 0; is included in else.
    .. zzz soooo tireed.

  4. #4
    Registered User
    Join Date
    Sep 2001
    Posts
    305
    mismatched braces, add another '}' to the end.

  5. #5
    Used Registerer jdinger's Avatar
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Checking array for string
    By Ayreon in forum C Programming
    Replies: 87
    Last Post: 03-09-2009, 03:25 PM
  2. Interpreter.c
    By moussa in forum C Programming
    Replies: 4
    Last Post: 05-28-2008, 05:59 PM
  3. Errors
    By Rhidian in forum C Programming
    Replies: 10
    Last Post: 04-04-2005, 12:22 PM
  4. syntax error at end of input
    By cerin in forum C++ Programming
    Replies: 3
    Last Post: 03-06-2005, 12:06 AM
  5. Reading integers until end of input
    By nivo in forum C Programming
    Replies: 7
    Last Post: 10-20-2001, 04:18 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21