Im a confused ultra-newbie, and I need help! Plz help me!

This is a discussion on Im a confused ultra-newbie, and I need help! Plz help me! within the C++ Programming forums, part of the General Programming Boards category; Ok the code below- when i comply it into an exe, it just flashes up a small windows app screen ...

  1. #1
    Registered User
    Join Date
    Jul 2002
    Posts
    22

    Question Im a confused ultra-newbie, and I need help! Plz help me!

    Ok the code below- when i comply it into an exe, it just flashes up a small windows app screen and i cant see whats in it. b4 it closes itself!!! here is the code that does the above problem:

    Code:
    #include <iostream.h>
    int main()
    {
      cout<<"HEY, you, I'm alive!  Oh, and Hello World!";
      return 0;    
    }
    Thanks in advance for any help!!

  2. #2
    Registered User
    Join Date
    Jul 2002
    Posts
    29

    Talking

    Try running it from the DOS mode...
    hehhe...
    Think you will understand after that

  3. #3
    Unregistered
    Guest

    Lightbulb Try this..

    Code:
    #include <iostream.h>
    
    main()
    {
        cout << "Hello";
        cin.get();
        return 0;
    }

    when you return a value, the purpose of a function is over
    so the program exits..

    what you're doing here is you're taking an input
    before returning a value... so the program runs till you press 'Enter'

    good luck.

    www.akilla.tk

  4. #4
    flashing vampire black's Avatar
    Join Date
    May 2002
    Posts
    563

    Post Re: Im a confused ultra-newbie, and I need help! Plz help me!

    what I used to is to add a line with cin:

    PHP Code:
    #include <iostream>
    void main()
    {
      
    cout<<"HEY, you, I'm alive!  Oh, and Hello World!";
      
    cin >> "stop here";

    try to compile it and see if it could have a pause.
    Never end on learning~

  5. #5
    Registered User
    Join Date
    Jul 2002
    Posts
    22

    Unhappy :(

    Black's idea got me a very breif pause, for maybe a fraction of a second...i think i've tried everything...none of it can get it to stay up.

  6. #6
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,267
    try

    Code:
    #include <iostream>
    #include <stdio.h>
    
    void..main()
    {
    ....cout<<"HEY, you, I'm alive!....Oh, and Hello World!";
    .. getchar();
    }
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

  7. #7
    Registered User billholm's Avatar
    Join Date
    Apr 2002
    Posts
    225
    If you use Borland, you might try using getch() instead if getchar()
    All men are created equal. But some are more equal than others.

    Visit me at http://www.angelfire.com/my/billholm

  8. #8
    Registered User
    Join Date
    Jul 2002
    Posts
    22

    Angry

    Nope, that didn't work either...could it be my complier...ive downloaded dev bloodhed, borland, and a whole bunch of others and havent been able to get any of them to work...

    i hope i'm not asking too much, but im gonna put that cpp file as an attachment to this post...if anyone wants to try and see whats wrong with it.
    Attached Files Attached Files
    • File Type: cpp 1.cpp (133 Bytes, 82 views)

  9. #9
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,267
    in reality that shouldn't even compile...

    try,

    Code:
    #include <iostream.h>
    #include <stdio.h>
    
    void..main()
    {
    ....cout<<"HEY, you, I'm alive!....Oh, and Hello World!";
    .. getchar();
    }
    if that don't work then i'm at a loss...
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

  10. #10
    Registered User
    Join Date
    Jul 2002
    Posts
    22

    Lightbulb

    well then i guess my complier is screwed up...

    could anyone post the compilable code for a dialog box in c++ for me?

  11. #11
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,267
    first, does the code compile ok?

    basic dialog boxes can be called like so

    Code:
    #include <windows.h>
    
    int main(void)
    {
        MessageBox(NULL,"Message goes here","title goes here",MB_OK);
        return 0;
    }
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

  12. #12
    Registered User
    Join Date
    Jul 2002
    Posts
    22

    Unhappy

    my complier doesnt work, so i wouldnt know... do you have an instant messenger??? if so, id like to speak with you on it

  13. #13
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,267
    my complier doesnt work, so i wouldnt know...

    what do you mean?

    >do you have an instant messenger???

    unfortunatly no, i don't use them for personal reasons.
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

  14. #14
    Registered User
    Join Date
    Jul 2002
    Posts
    22

    Angry

    well one of them will compile anythiing that has a .cpp file extension, and the other one wont wont compile anything period.

  15. #15
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,267
    well try compiling the exact code in my last post an see if it works, in the one that compiles...

    >and the other one wont wont compile anything period.

    what does it do?
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

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