re; first c#

File>New Project>Visual C#>Console Application

HelloWorld!


using System;     //'using' includes an existing code library(namespace)

namespace ConsoleApplication1
{
    class Program
    {
        static void Main() //c# console begin in Main() method
        {
            //'output is declared as text string
            //value of output is Hello World!
            string output = "Hello World";
            Console.WriteLine(output);
            Console.ReadLine();
        }
    }
}


Run.
Output.
Hello World.

BREAKPOINTS


using System;

namespace breakpoints
{
    class Program
    {
        static string title = "The sum is:";
        static void ShowSum()
        {
            int x = 55;
            int y = 66;
            int sum = x + y;
            Console.WriteLine(sum);
        }
        static void Main()
        {
            Console.WriteLine(title);
            ShowSum();
            Console.ReadLine();
        }
    }
}


Run.
Output.
The sum is:
121

Comments

Popular posts from this blog

DESTROY ALL VOX ZEPPELINS!!! BIOSHOCK INFINITE

My weakest subject

Rahsia Cerdas, Pintar Dan Ingatan Fotografi