+ 1

in c++,If i want multiple line breaks how could i get it.

For example, cout << "hello world "; if i need 5 line breaks , cout << "hello world \n\n\n\n\n " insted of typing \n five times....is there any easy method ?

2nd Feb 2017, 6:11 PM
Birendra Yasas
Birendra Yasas - avatar
5 Réponses
+ 3
You can use loop: for(int i=1;i<=5;i++) { std::cout<<"\n"; }
2nd Feb 2017, 6:27 PM
Frendom
+ 1
@jacob , yeah it \n makes a line break..but if u need 100 line breaks...are u dare to type 100 of \n ? so far the 1st answer ( using for loop ) seems fine
9th Feb 2017, 4:33 PM
Birendra Yasas
Birendra Yasas - avatar
+ 1
simply no..
8th Oct 2017, 8:32 PM
Rishu
Rishu - avatar
0
cout<<endl; five times beyond that idk.
2nd Feb 2017, 6:17 PM
david schlemmer
david schlemmer - avatar
0
\n makes a line break
9th Feb 2017, 4:29 PM
Jacob Ewing