Line break in code
Solved
Hello everyone,
I am new to this forum and I am starting with C++.
I have some basics in programming in other languages, like Matlab.
So, here's my question:
How is it possible to create a line break in the code (and not in the program) to avoid writing long lines? In Matlab, we simply use the characters "..." at the end and the beginning of the next line.
Basically, I want to do something like:
cout << "blablabla\n [line break]
blablablablabla\n"
Instead of having:
cout << "blablabla\n blablablablabla\n"
Thank you for your help :)
I am new to this forum and I am starting with C++.
I have some basics in programming in other languages, like Matlab.
So, here's my question:
How is it possible to create a line break in the code (and not in the program) to avoid writing long lines? In Matlab, we simply use the characters "..." at the end and the beginning of the next line.
Basically, I want to do something like:
cout << "blablabla\n [line break]
blablablablabla\n"
Instead of having:
cout << "blablabla\n blablablablabla\n"
Thank you for your help :)
Configuration: Windows XP Firefox 2.0.0.2
2 answers
-
It seems to me that you are answering your own question!!!
As far as I remember, there is no particular syntax, except in matlab!
--Practice doesn't make perfect, it makes champions! If winning isn't important, why do we keep score?
-
no no, it actually exists!
I had a hard time finding it, but after digging around on the internet, I finally found it.
So for those who might be interested, there is indeed such a character, as it is the character "\".
In our case:
cout << "blablabla\n \
blablablabla" << endl;
instead of:
cout << "blablabla\n blablablablabla" << endl;
That's it
Thanks anyway :)
-