re; first c#
File>New Project>Visual C#>Console Application
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();
}
}
}
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
Post a Comment