0
Why can't I see hello world in the black screen???
I am using mycrosoft visual for c# programs.But when I use writeline function ,such as, console.writeline("hello world").It opens a black screen and close it so quickly that I am unable to find what it has printed.what should I do under this circumstance?
3 Answers
+ 5
Visual Studio doesn't prompt you to close the window. When the code is done, it closes on its own.
Put Console.ReadKey(); or Console.ReadLine(); as the last line of your code so it waits for an input.
+ 1
the opening and closing shows your program ran successfully. try something like
console.writeline("hello world! ");
console.readline();
readline is used for input, so you'll be able to see your output for hello world as the console windows waits for input in order to close.
see more of this codes on my profile
+ 1
Console.Read(); use this