Teen Programmers Unite  
 

 

Return to forum top

new to c++ need some simple help

Posted by steelmole [send private reply] at July 23, 2001, 02:40:39 PM

well im very new to c++ so i`ll keep it short does anyone know how to use 2 cout functions and have the output on the same line so im just wondering lease reply soon. sorry i accidentily posted this 2 times

Posted by lordaerom [send private reply] at July 23, 2001, 03:25:00 PM

The output will stay on a sinbgle line until you output something that will cause a new line to be used, such as endl.

For example
cout<<"This is a line";
cout<<"This is still the same line";
cout<<endl<<"Now I am on a new line!";

shuld print
This is a lineThis is still the same line
Now I am on a new line

Unless, of course, I am horribly wrong.
But I don't think I am.

Posted by TheTutor [send private reply] at July 23, 2001, 06:54:46 PM

As long as you don't put an "endl" or a "\n" in your cout, it will always be on the same line -- That doesn't mean your console window won't automatically word-wrap it though :)

You must be logged in to post messages and see which you have already read.

Log on
Username:
Password:
Save for later automatic logon

Register as a new user
 
Copyright TPU 2002. See the Credits and About TPU for more information.