none
What do I do?? RRS feed

  • Question

  • I have a question concerning the console output,  how do I put linefeed during the out of the program?
    "Pres any key to continue" on the next line,  & not on the same line as the current line.  I hope somebody will understand this.

    Richard West
    Wednesday, December 23, 2009 6:26 AM

Answers

  • Hello Richard,

    You can use endl or "\n" to break the output to next line.

    #include "iostream"
    
    using namespace std;
    
    int main(int argc, char* argv[])
    {
       // You can use endl to break to newline.
       cout << "Hello there" << endl;
       cout << "Press Any key to continue" << endl;
    
       // You can also use \n
       cout << "Hello there\n";
       cout << "Press Any key to continue\n";
    
    	return 0;
    }
    

    Best Regards,
    Jijo.

    http://weseetips.com [^ ] Visual C++ tips and tricks. Updated daily.
    • Marked as answer by Nancy Shao Friday, December 25, 2009 5:30 AM
    Wednesday, December 23, 2009 6:52 AM

All replies

  • Hello Richard,

    You can use endl or "\n" to break the output to next line.

    #include "iostream"
    
    using namespace std;
    
    int main(int argc, char* argv[])
    {
       // You can use endl to break to newline.
       cout << "Hello there" << endl;
       cout << "Press Any key to continue" << endl;
    
       // You can also use \n
       cout << "Hello there\n";
       cout << "Press Any key to continue\n";
    
    	return 0;
    }
    

    Best Regards,
    Jijo.

    http://weseetips.com [^ ] Visual C++ tips and tricks. Updated daily.
    • Marked as answer by Nancy Shao Friday, December 25, 2009 5:30 AM
    Wednesday, December 23, 2009 6:52 AM
  • Hello Jijo Raj,

    Just wondering, since you are a C++ master programmer.   What files would I need for 3D graphics or more to say OpenGL, & also how would install those files?   I'm starting to enjoy Visual C++ programming.   I'm actually confused to which files to use.   Visual C++ apprently does not have all the files neccessary to perform these task.  Please help me ok.

    Sincerely ,
    A Visual C++ User,
    Richard West

    P.S. How would I register on your web-site?   I just looked at your web-site, it's beautiful!
     
    Thursday, December 24, 2009 12:34 AM
  • Your original question has been answered. Please post completely new questions in a completely new thread. And please don't forget to mark Jijo's post as "the answer".

    Thursday, December 24, 2009 1:34 AM
  • Your original question has been answered. Please post completely new questions in a completely new thread. And please don't forget to mark Jijo's post as "the answer".


    ... and please use a descriptive subject for your post next time.

    David Wilkinson | Visual C++ MVP
    Thursday, December 24, 2009 1:26 PM
  • Hi Richard,

    >> What files would I need for 3D graphics or more to say OpenGL, & also how would install those files?
    I'm really sorry that I didn't see your reply. I hope you already got the answer from What GL files I need?? thread.

    >> Just wondering, since you are a C++ master programme r
    I'm still a C++ Padawan , Not a master yet. :)

    >> I'm starting to enjoy Visual C++ programming.
    Great! I'm sure that you will love it.

    >> P.S. How would I register on your web-site?   I just looked at your web-site, it's beautiful!
    Thanks for those kind words. Infact its my personal blog, so no need to register.
    If you are interested to get updates, just subscribe the RSS feed.

    Best Regards,
    Jijo.


    http://weseetips.com[^] Visual C++ tips and tricks. Updated daily.
    Friday, December 25, 2009 7:23 AM