Thread: displaying text below user input (cin)

  1. #1
    Registered User
    Join Date
    Sep 2009
    Posts
    5

    displaying text below user input (cin)

    Hi~ My question is: Is there a way to display text below the user input (in this case "cin>>") in a console application? I want the text to be displayed when the input is also displayed.


    here's an example of what I mean...

    Text here

    User input here
    more text underneath.

  2. #2
    Webhead Spidey's Avatar
    Join Date
    Jul 2009
    Posts
    285
    Code:
    cout << "Text here" <<endl << endl;
    cin >> input;
    cout << "More text here" << endl;
    Spidey out!

  3. #3
    Registered User
    Join Date
    Sep 2009
    Posts
    5
    Unfortunately that displays the text after a user has entered an input. I want the text to be displayed before the user inputs anything.

  4. #4
    Not stupid, just stupider yaya's Avatar
    Join Date
    May 2007
    Location
    Earthland
    Posts
    204
    You'll have to move the "cursor" back up to do the input. The way to do this varies by OS.

  5. #5
    Registered User
    Join Date
    Oct 2009
    Posts
    3
    If you want to use a function where you can define a place that you print to. I think you can use tellp (ostream). It moves a file pointer to place where you specify. Standard output is in the console unless you define a file. So you may be able to move the cout to the last place you were at for instance -20 chars. Or whatever you want to go back..

    I don't know how to use it or even if it can be used in this way, but someone might.

    Just a thought.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. User determined input question
    By lyoncourt in forum C Programming
    Replies: 8
    Last Post: 09-30-2007, 06:10 PM
  2. Choosing a variable based on user text input.
    By Compiling... in forum C++ Programming
    Replies: 7
    Last Post: 11-01-2005, 01:21 AM
  3. ~ User Input script help~
    By indy in forum C Programming
    Replies: 4
    Last Post: 12-02-2003, 06:01 AM
  4. text input in graphics mode
    By jamie in forum C++ Programming
    Replies: 1
    Last Post: 03-17-2003, 10:33 PM
  5. Replies: 1
    Last Post: 07-13-2002, 05:45 PM

Tags for this Thread