Printing three different line statements | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Printing three different line statements

i have int main() { prints<<"text"<<endl; ?????<<"text"<<endl; ?????<<"text"<<endl; ?????<<"text"<<endl; ?????<<"text"<<endl; then is it return 0; } im confused what to put in place of ???? and how to make sure it prints each text sentence and are they considered var const or my class, im just alittle confused qhen you put the codes into a page how you tell the diff. i hope that made since can someone just simplify it for me. thanks

22nd Jan 2017, 5:13 AM
terri
terri - avatar
13 Answers
+ 6
???? = cout
22nd Jan 2017, 5:16 AM
Kawaii
Kawaii - avatar
+ 4
cout<<"hai\nhai\nhai";
29th Jan 2017, 2:50 PM
Konduru. Chandana Sree
Konduru. Chandana Sree - avatar
+ 2
You don't have to do it on each line, but you can, what you can also do is: cout << "text" << endl << "text" << endl << "text" << endl << "text" << endl << "text" << endl << "text" << endl; But it can get a little messy.
22nd Jan 2017, 5:54 AM
Dawzy
Dawzy - avatar
+ 2
I think the best is, this.. cout<<"text \n text \n text \n";
5th Feb 2017, 4:59 AM
Eshwar Prasad
Eshwar Prasad - avatar
+ 1
have to type it sep. on each line?
22nd Jan 2017, 5:47 AM
terri
terri - avatar
+ 1
do you have to put a return 0 befor the} at the end, it waa causing error saying return wasnt declared
22nd Jan 2017, 5:56 AM
terri
terri - avatar
+ 1
thank you for your imput helps alot
22nd Jan 2017, 5:57 AM
terri
terri - avatar
+ 1
u cn also try this { cout<<"text \n text \n text \n";
29th Jan 2017, 1:20 AM
Kaushal Raj
Kaushal Raj - avatar
+ 1
if you are using code blocks than,it is not necessary to write return.....compiler automatically insert return 0
29th Jan 2017, 1:22 AM
Kaushal Raj
Kaushal Raj - avatar
0
ничего не понял
29th Jan 2017, 9:31 PM
Влад Игнашов
Влад Игнашов - avatar
0
cout
2nd Feb 2017, 7:03 AM
Mangesh Sonawane
Mangesh Sonawane - avatar
0
cout is fell in place of ?????
3rd Feb 2017, 5:11 PM
B.sruthireddy
B.sruthireddy - avatar
0
\n is an better alternative for endl
28th Feb 2017, 4:23 AM
Akash Naik