please help a newb

This is a discussion on please help a newb within the C++ Programming forums, part of the General Programming Boards category; i have read the faq and havent found the answer to my question, but if its there, then please tell ...

  1. #1
    Registered User
    Join Date
    Nov 2002
    Posts
    20

    please help a newb

    i have read the faq and havent found the answer to my question, but if its there, then please tell me and i will say sorry for asking it.
    it said on your site that to keep the window open simply write "cin.get();" before you write "return 0;". now that works fine when all im doing is writing text that it will display, but when the user has to write a number or whatever, to see whatever comes after he must push enter. but enter also closes the program and so he doesent get to see what happens next. is there any way to fix this? any help would be appreciated and if you dont understand what im saying then ill try to explain it better.


    thank you

  2. #2
    TransparentMember correlcj's Avatar
    Join Date
    Jun 2002
    Posts
    378
    any help would be appreciated and if you dont understand what im saying then ill try to explain it better.
    Do you mean by inputting the EOF() as -1? I am confused by nature, can U plz explain further. If you have an example even better.
    sorry!
    cj
    "Be formless, shapeless, like water... You put water into a cup, it becomes the cup, you put water into a bottle, it becomes the bottle, you put it in a teapot, it becomes the teapot... Now water can flow, or it can crash, be water my friend."
    -Bruce Lee

  3. #3
    Registered User
    Join Date
    Nov 2002
    Posts
    1,109
    okay, try this...

    Code:
    #include <stdlib.h>
    
    int main()
    {
          // main stuff
    
          system("PAUSE");
          return 0;
    }
    
    //actually, i think you should #include <cstdlib> for purposes of C++ standard

  4. #4
    Registered User
    Join Date
    Nov 2002
    Posts
    20

    Talking

    thanx a LOT alpha! it worked!!!!

    PS if you still want me to explain further cj then say

  5. #5
    Registered User
    Join Date
    Nov 2002
    Posts
    1,109
    no problem...glad i could help...

  6. #6
    Registered User
    Join Date
    Sep 2002
    Posts
    11
    i always just put in cin.get(); twice, but i bet that system pause is easier
    I'm not here. This isn't happening

  7. #7
    Just a Member ammar's Avatar
    Join Date
    Jun 2002
    Posts
    953
    You can also use getch();
    it will do the job.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Newb Question Character Counting
    By Wilder in forum C Programming
    Replies: 13
    Last Post: 06-22-2008, 11:37 PM
  2. Dogpile the newb!
    By lindy in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 05-23-2008, 08:17 AM
  3. Total newb directx invisable geometry question
    By -pete- in forum Game Programming
    Replies: 5
    Last Post: 08-13-2006, 01:45 PM
  4. Newb C++ Programmer
    By Philandrew in forum C++ Programming
    Replies: 8
    Last Post: 10-19-2004, 08:44 PM
  5. if your not newb you can help me
    By Klinerr1 in forum C++ Programming
    Replies: 6
    Last Post: 05-05-2002, 12:09 AM

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