@Brawn/

Chapter 1

C#

Making console app do something page 19

fork
loading
Files
  • main.cs
  • main.exe
main.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using System;

namespace Program1
{
	public class Program
	{
		//this is where program starts
		static void Main(string[] args)
		{
			//tells user to enter a name
			Console.WriteLine("Enter you name, please");

			//Now read the name entered
			string name = Console.ReadLine();

			//Greet the user with the name entered before
			Console .WriteLine("Hello. " + name);

			//Wait for user to acknowledge the results
			Console.WriteLine("Press Enter to terminate...");
			Console.Read();
		}
	}
}