Error?? NOOO!!!!!!!

This is a discussion on Error?? NOOO!!!!!!! within the C++ Programming forums, part of the General Programming Boards category; What is wrong?? I get a error called : parse error before 188 #include <iostream> int main () { int ...

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

    Unhappy Error?? NOOO!!!!!!!

    What is wrong??

    I get a error called :

    parse error before 188


    #include <iostream>

    int main ()
    {
    int money;

    #define ihave 188


    int ihave;

    int lost;

    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;

    lost -= ihave;
    money += ihave;

    cout << "Så här mycket pengar har du nu!" << endl;

    cout << ihave << endl;


    return 0;
    }
    .. zzz soooo tireed.

  2. #2
    EDL
    EDL is offline
    Registered User
    Join Date
    May 2002
    Posts
    18
    Hmmm, I can't really remember, but I don't think you can #define ihave and have it as an int at the same time. try

    Code:
    int ihave = 188;

  3. #3
    Registered User
    Join Date
    May 2002
    Posts
    23
    so what do i have to do?

    sorry i did not see the code.
    .. zzz soooo tireed.

  4. #4
    EDL
    EDL is offline
    Registered User
    Join Date
    May 2002
    Posts
    18
    i think try deleting the #define and then set

    int ihave = 188;

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

    Question New errors.

    C:\WINDOWS\TEMP\ccvQF7fb.o(.text+0x94):pengar.cpp: undefined reference to `GetStockObject@4'

    I,ve got that error now.

    The Compiler doesnt show any errors but after compiling a window pops-up with the text above in it.

    where the smiley is its supposed to be : and then a p.
    .. zzz soooo tireed.

  6. #6
    EDL
    EDL is offline
    Registered User
    Join Date
    May 2002
    Posts
    18
    Also, I can't really understand what you're trying to say, but Try this:

    Code:
    ihave -= lost; 
    ihave += money;

  7. #7
    EDL
    EDL is offline
    Registered User
    Join Date
    May 2002
    Posts
    18

    Re: New errors.

    Originally posted by erikcn
    C:\WINDOWS\TEMP\ccvQF7fb.o(.text+0x94)engar.cpp: undefined reference to `GetStockObject@4'

    I,ve got that error now.

    The Compiler doesnt show any errors but after compiling a window pops-up with the text above in it.
    Hmmm, I have no idea what that error is. I just tried to compile your program, and it runs fine for me. I deleted the #define, set int ihave = 188;, and then switched the other 2 lines around.

  8. #8
    Registered User
    Join Date
    May 2002
    Posts
    23
    Already have that code in the file.
    .. zzz soooo tireed.

  9. #9
    Registered User
    Join Date
    May 2002
    Posts
    23
    what compiler do you use.
    .. zzz soooo tireed.

  10. #10
    EDL
    EDL is offline
    Registered User
    Join Date
    May 2002
    Posts
    18
    What compiler are you using? I use Visual C++ 6.0

  11. #11
    Registered User
    Join Date
    May 2002
    Posts
    23
    Bloodshed Dev C++. how about you?
    .. zzz soooo tireed.

  12. #12
    EDL
    EDL is offline
    Registered User
    Join Date
    May 2002
    Posts
    18
    Maybe it's a problem with your compiler? I don't know, this seems like pretty basic C++ so I would assume it shouldn't have any problems with the code. Here is exactly what I put into my compiler.

    Code:
    #include <iostream.h> 
    
    
    int main () 
    { 
    int money; 
    
    
    
    int ihave = 188; 
    
    int lost; 
    
    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 -= lost; 
    ihave += money; 
    
    cout << "Så här mycket pengar har du nu!" << endl; 
    
    cout << ihave << endl; 
    
    
    return 0; 
    }

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

    Wink try another

    I'll try the borland free compiler.
    .. zzz soooo tireed.

  14. #14
    EDL
    EDL is offline
    Registered User
    Join Date
    May 2002
    Posts
    18

    Re: try another

    Originally posted by erikcn
    I'll try the borland free compiler.
    Hehe, let me know how it turns out. I'm curious why it's not working for you.

  15. #15
    Unregistered
    Guest
    DEVC++ owns you up so bad. Borland sucks.


Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

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