What im wondering, is because im making a little text adventure game, and i have to write lots of descriptive writing and i would like it all to stay together in a paragraph. But the only way of getting that on output that i know of is to just have one realy, realy long cout.

like this.

cout << "You enter the cave as a monster apears blah blah blah and it just goes on and doesn't look nice in the compiler." << endl;

Of course in the compiler it doesn't go to the next line like here, which is what im looking for. A way to continue the cout or do a new cout without a break.

Anywhoo any help would be greatly appreciated with this. cause i badly need a way to clean up.
Cheers.:icon_cheesygrin:

Recommended Answers

All 3 Replies

You can add \n to the out put and it will put it on a new line. as in:

cout << "You enter the cave as a monster apears\n blah blah blah and\n it just goes on and doesn't look nice in the compiler." << endl;

it will show up as,

You enter the cave as a monster apears
blah blah blah and
it just goes on and doesn't look nice in the compiler.

In C and C++ string concatenation of adjacent string literals is automatic.

cout << "You enter the cave as a monster apears "
           "blah blah blah and it just goes on and "
           "doesn't look nice in the compiler." << endl;

Thanks so much both of you, cheers. that second one was just what i was looking for, hope it works.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.