tutorials on site

This is a discussion on tutorials on site within the C++ Programming forums, part of the General Programming Boards category; I am going through the tutorials on this site, and the first few programs i compile (copied code from tutorial ...

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    23

    Question tutorials on site

    I am going through the tutorials on this site, and the first few programs i compile (copied code from tutorial to try) do not show up on my screen. Cursor turns to hourglass for a few seconds, and then back to normal. I'm using Dev C++ compiler, trying to compile

    #include <iostream.h>
    int main()
    {
    int thisisanumber;
    cout<<"Please enter a number:";
    cin>>thisisanumber;
    cout<<"You entered: "<<thisisanumber;
    cin.get();
    return 0;
    }

    but no windows or anything show up. That is the entire code, nothing else... gotta admit, i'm not exactly sure any windows are supposed to pop up or anything... maybe i havent gotten far enough...

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Try getting a DOS prompt, CD'ing to the directory containing your EXE's and running them from there by typing the name of the EXE. What happens?
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  3. #3
    Registered User
    Join Date
    Sep 2001
    Posts
    23
    It acts as though it's going to do something, I'm pretty sure it runs the program, because on the top of the prompt, it shows the complete file path for the .EXE, including the EXE's name, it does this for about 3 seconds, and goes back to my folder prompt. I would think such a simple little program would work for me, but noo...

  4. #4
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Most strange...

    The code you gave works OK for me, I did make a small amendment (added cin.ignore() to clear the input buffer).
    Code:
    #include <iostream.h>
    
    int main(void)
    {
        int thisisanumber;
        cout << "Please enter a number:";
        cin >> thisisanumber;
        cout << "You entered: " << thisisanumber;
        cin.ignore();
        cin.get();
        return(0);
    }
    
    /*
    
    Program Output:
    C:\temp>junk1.exe
    Please enter a number:11
    You entered: 11
    
    */
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  5. #5
    Registered User
    Join Date
    Sep 2001
    Posts
    23
    Tried your code, Hammer, and it doesn't even compile! I get the following error:

    D:\DEVCOM~1\DEVCPP4\LIB\\libmingw32.a(main.o)(.tex t+0x8e): undefined reference to `WinMain@16'
    I even tried tweaking it, took out
    Code:
    cin.ignore();
    Didn't work

    Tried taking out the void in int main()

    Didn't work


  6. #6
    Registered User
    Join Date
    Sep 2001
    Posts
    23
    As i said before, im using Dev c++ 4...

    When I go to create a new project, should i click console application, instead of empty project? or are they the same thing if i do console and delete all the pre-made code?

  7. #7
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    The code you are trying to compile is for a console app. I don't know how Dev C++ works (I don't use it myself). Maybe some else on here knows what options you have to set..... ?

    In the meantime, check the online help (I presume it has one?) for info on how to compile a console app.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  8. #8
    Registered User
    Join Date
    Sep 2001
    Posts
    23

    Thumbs up

    You are absolutely correct. It is a console app. I tried starting it in a console template, pasted in the code, compile, and it compiled fine. Went to run it, I didn't even need to open a DOS prompt, it now works fine. Thanks for your help and time!

  9. #9
    Christ
    Guest

    Angry >>I don't know how Dev C++ works (I don't use it myself

    >>I don't know how Dev C++ works (I don't use it myself).

    Then don't talk mister!!!!!.. ???
    You always want to put your mouth in the middle of everything...
    as if you know everything.. phhh... i've seen many *'s like you.

  10. #10
    Registered User
    Join Date
    Sep 2001
    Posts
    23

    Thumbs down

    Yeah, excuse you. Look at yourself.

  11. #11
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231

    Re: >>I don't know how Dev C++ works (I don't use it myself

    Originally posted by Christ
    >>I don't know how Dev C++ works (I don't use it myself).

    Then don't talk mister!!!!!.. ???
    You always want to put your mouth in the middle of everything...
    as if you know everything.. phhh... i've seen many *'s like you.
    Oh, great... another idiot on the board

    >You always want to put your mouth in the middle of everything
    This would imply that there were already two people talking. There wasn't, there was only one, so how can there be a middle?

    How can I be talking "as if you know everything", when I clearly stated "I don't know..."? Don't you understand English?

    If you don't have anything useful to say, then don't post. Can you understand that?

    For the record, I managed to help BuRtAiNiAn and get him/her underway, even without knowing Dev-C++ (this is only a C++ board after all).
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  12. #12
    Registered User
    Join Date
    Sep 2001
    Posts
    23

    Thumbs up

    I would be a him


  13. #13
    Unregistered
    Guest

    Well A hole..

    Well, ******* When you "don't know"
    you don't need to open your mouth..

    that's what i meant...
    you're more idiotic than the worst idiot i have seen.

    if you're a human, you'll shut up now.. no more replies!!

  14. #14
    Registered User
    Join Date
    Jan 2002
    Posts
    387
    The "i dont know" was only PART of the post, here was the whole post useful part bolded

    The code you are trying to compile is for a console app. I don't know how Dev C++ works (I don't use it myself). Maybe some else on here knows what options you have to set..... ?

    In the meantime, check the online help (I presume it has one?) for info on how to compile a console app.
    So, read the whole post before you open your mouth next time.
    "There are three kinds of people in the world...
    Those that can count and those that can't."

  15. #15
    Registered User
    Join Date
    Sep 2001
    Posts
    23
    I know I shouldn't reply anymore, but I have a tendancy to do so on forums. They are so darn fun. Here is the post, with the correct useful parts bolded:

    The code you are trying to compile is for a console app. I don't know how Dev C++ works (I don't use it myself). Maybe some else on here knows what options you have to set..... ? In the meantime, check the online help (I presume it has one?) for info on how to compile a console app.
    Off topic:

    To see some of my best forum posts, check out:

    http://www.adrift.org.uk/ubb/Forum1/HTML/002778.html

    Otherwise, well, don't!

    Now stop posting to this topic. Problem has been solved.

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

Similar Threads

  1. Why don't the tutorials on this site work on my computer?
    By jsrig88 in forum C++ Programming
    Replies: 3
    Last Post: 05-15-2006, 11:39 PM
  2. Got any tutorials or programs?? Send them to my web site!
    By robmil29 in forum C++ Programming
    Replies: 6
    Last Post: 09-27-2004, 12:38 PM
  3. Best way to organize tutorials
    By jverkoey in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 05-30-2004, 05:41 AM
  4. Site tutorials
    By Aalmaron in forum C++ Programming
    Replies: 20
    Last Post: 01-06-2004, 02:38 PM

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