escaping - In C++, how can I cout a logo that features many special characters? -
i have logo features many special characters, such escape characters, , want print terminal. how should without compiler throwing "unknown escape sequence" errors?
here example code (that features 1 problematic character -- not, say, hundreds):
void print_logo(); int main(){ print_logo(); return 0; } void print_logo(){ std::cout << "\_ hello _/\n"; }
note manually escaping of special characters in logo not option.
how raw literals?
#include <iostream> int main() { const char* tree = r"===( * , _/^\_ < > * /.-.\ * * `/&\` * ,@.*;@, /_o.i %_\ * * (`'--:o(_@; /`;--.,__ `') * ;@`o % o,*`'`&\ * (`'--)_@ ;o %'()\ * /`;--._`''--._o'@; /&*,()~o`;-.,_ `""`) * /`,@ ;+& () o*`;-';\ (`""--.,_0 +% @' &()\ /-.,_ ``''--....-'`) * * /@%;o`:;'--,.__ __.'\ ;*,&(); @ % &^;~`"`o;@(); * /(); o^~; & ().o@*&`;&%o\ jgs `"="==""==,,,.,="=="==="` __.----.(\-''#####---...___...-----._ '` \)_`"""""` .--' ') o( )_-\ `"""` ` )==="; std::cout << tree; };
Comments
Post a Comment