0

New line

I have been trying to solve a problem on new line, requiring me to output C + + Instead of "C++" I have done it in so many ways but they seem not to be accepting my method. Can anyone help?

25th Jan 2022, 11:26 PM
Elechi Allwell Chimekwa
Elechi Allwell Chimekwa - avatar
6 Answers
+ 5
Show us your code Oo"
25th Jan 2022, 11:34 PM
SoloProg
SoloProg - avatar
+ 4
#include <iostream> using namespace std; int main() { char w[] = "C++"; int ln = sizeof(w)-1; for (int i=0; i<ln; i++) cout << w[i]; cout << endl << endl; for (int i=0; i<ln; i++) cout << w[i] << endl; return 0; } https://code.sololearn.com/c9l51nWJa6DB Good Luck
26th Jan 2022, 1:49 AM
SoloProg
SoloProg - avatar
0
Thanks a lot
26th Jan 2022, 11:49 AM
Elechi Allwell Chimekwa
Elechi Allwell Chimekwa - avatar
0
This is actually to complex for my level
26th Jan 2022, 11:50 AM
Elechi Allwell Chimekwa
Elechi Allwell Chimekwa - avatar
0
Check this page, yo ucan see there more ways to solve your problem https://www.udacity.com/blog/2021/08/creating-a-new-line-in-cpp.html
26th Jan 2022, 8:08 PM
PanicS
PanicS - avatar
0
The new line character is ‘\n’ or you can insert the endl manipulator
26th Jan 2022, 8:28 PM
Casen
Casen - avatar