Microsoft Visual Studio, how to code so that a ASCII will display on my console application?
I want to incorporate an ASCII image as it can be seen here o开发者_StackOverflow社区r something like that, on my console application but I am not sure how to get it in there I have been trying:
console.writeline("");
but that does not seem to work.
This
Console.WriteLine(@" ud$$$**$$$$$$$bc.");
Console.WriteLine(@" u@**"" 4$$$$$$$Nu");
Console.WriteLine(@" J ""#$$$$$$r");
Console.WriteLine(@" @ $$$$b");
Console.WriteLine(@" .F ^*3$$$");
Console.WriteLine(@" :% 4 J$$$N");
Console.WriteLine(@" $ :F :$$$$$");
Console.WriteLine(@" 4F 9 J$$$$$$$");
Console.WriteLine(@" 4$ k 4$$$$bed$$$$$$$$$");
works for me. I added an @ before the strings to disable escape characters and I had to double up any quotes so that they did not get interpreted as the end of the string.
So, if you write
Console.WriteLine("\n");
then that gets interpreted as a newline. But
Console.WriteLine(@"\n");
will emit \n
to the console.
Similarly you can't write
Console.WriteLine(@" u@**" ");
That's probably the cause of the errors you have seen. Hence you would write:
Console.WriteLine(@" u@**"" ");
Anyway, although that makes it work it's much better to put the ASCII art in a text file or a resource and get at it that way – that avoids all these pitfalls.
If the ascii image is stored in a file you could use a stream reader and Console.WriteLine(). Make sure you check your code for case-sensitivity. console.writeline(""); is not the same as Console.WriteLine("");.
精彩评论