Reputation: 482
I am trying to pimp up the programs I wrote with fancy ASCII-Art,
I can't manage to display it on the console though, is there a way I can output
pre-formatted text, just as <pre>
in HTML? I am using cout for most output.
_____ _
|_ _| | |
| | ___ ___ | |_
| | / _ \/ __|| __|
| || __/\__ \| |_
\_/ \___||___/ \__|
Upvotes: 1
Views: 689
Reputation: 63124
Use raw string literals:
std::string const asciiTest = R"~(
_____ _
|_ _| | |
| | ___ ___ | |_
| | / _ \/ __|| __|
| || __/\__ \| |_
\_/ \___||___/ \__|
)~";
Within a RSL you don't need to escape special characters, and newlines are preserved.
This is a double-edged sword though: identation and leading/trailing newlines are also preserved, so you need to take care of them.
Upvotes: 4