Thread: Cout<< Problems!

  1. #1
    Registered User
    Join Date
    Aug 2003
    Posts
    3

    Question Cout<< Problems!

    The screen displays Hello when I use cout<<"hello"; for only like one second (I think because I have virtual DOS) But I need it to stay untill I press enter or something what is the command for that?

    Someone told me before but I forgot, I think it was something like cin.get;

  2. #2
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    Check the FAQ. Its in there.
    The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.

  3. #3
    Registered User
    Join Date
    Mar 2002
    Posts
    249
    You mean getch()?
    Well, there are a few things wrong with your code:

    1) It does not work.
    2) It does not work.
    3) It does not work.

    Hope this helps.

  4. #4
    Registered User
    Join Date
    Aug 2003
    Posts
    3

    Its ok

    I found it it was std::cin.get(); but now I need to know how to put charcters (More than one) into my program, like I ask someone to type there name and tell them the name they typed, and I looked all in the FAQ but couldnt find it!

  5. #5
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    Easiest is to use std::string (in <string>).
    For example:
    Code:
    string str;
    cin >> str; // Gets you the first word.
    getline(cin, str); // Gets you the whole line.
    *edit*
    A relevant link.
    Last edited by Zach L.; 08-13-2003 at 08:17 PM.
    The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.

  6. #6
    1479
    Join Date
    Aug 2003
    Posts
    253
    I think this is what you are looking for
    Code:
    system("pause")
    put that right before you return 0;
    Knowledge is power and I want it all

    -0RealityFusion0-

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. No clue how to make a code to solve problems!
    By ctnzn in forum C Programming
    Replies: 8
    Last Post: 10-16-2008, 02:59 AM
  2. String Manipulation problems -_-
    By Astra in forum C Programming
    Replies: 5
    Last Post: 12-13-2006, 05:48 PM
  3. Rendering problems (DirectX?)
    By OnionKnight in forum Tech Board
    Replies: 0
    Last Post: 08-17-2006, 12:17 PM
  4. contest problems on my site
    By DavidP in forum Contests Board
    Replies: 4
    Last Post: 01-10-2004, 09:19 PM
  5. DJGPP problems
    By stormswift in forum C Programming
    Replies: 2
    Last Post: 02-26-2002, 04:35 PM