Finally,masuk jga ATL,walau ga tau muzti ngapain…- -‘

Kesan pertama,bingung,ga tau mzti ngapain,akhirnya sih browsing cari2 bahan c-sharp (ambil numpang download2^^,kencangnya,lokal 5-10 mb,ckck,kpn kos gw net nya sgni…..)

First time i look n trying to understand c-sharp,i have no idea,what kind of programming language is it….

But after i try,i hv understand a little,c-sharp is alike C n C++ but it’s using a class to define something…

N it’s pure case sensitive…. If at C n C++ u use main,here u must write down “Main”,not “main”

For write something into the output,it’s alike C,except u must define it at class n use “Console.Write(”   “)” or “Console.WriteLine(”   “)”

n if at C or C++ we use standart library,such as stdio.h,iostream.h,here we use NameSpace

So if we Console,we must declare “using System” as the NameSpace

Example :

// Namespace Declaration
using System;

// Program start class
class WelcomeCSS
{
// Main begins program execution.
static void Main()
{
// Write to console
Console.WriteLine(“Welcome to the C# Station Tutorial!”);
}
}

or,if u don’t want use “using Console”,u can use

// Program start class
class WelcomeCSS
{
// Main begins program execution.
static void Main()
{
// Write to console
System.Console.WriteLine(“Welcome to the C# Station Tutorial!”);
}
}

so here we declare main inside a class,and than inside main we can use all of output n input

U must declare input n output declaration inside main,u cannot put it outside main/method

n if u want to hold the screen for not closing after execution,u can use

Console.ReadKey();

or

Console.ReadLine();

n if u want to enter a variable into output,if in C u use printf(“%d %c”,a,b)

here u use “{number}”

Console.Write(“{0} {1} “,a,b);

n for the input u can use this format

Console.Write(“What is your name?: “);

Console.Write(“Hello, {0}! “, Console.ReadLine());


Here before program display Hello,it will ask for the input.

or,u can use

Console.Write(“What is your name?: “);

string a=Console.ReadLine();

Console.Write(“Hello, {0}! “, a);

And if u want to input int,u must convert it into int ,cause ReadLine return string

Example :

using System;

class coba
{
public static void Main()
{
string a;
int b;
Console.Write(“Enter Number : “);
a=Console.ReadLine();
b = Int32.Parse(a);
Console.Write(“{0}”, b);
Console.ReadKey();
}
}

Int32.Parse(a) is used for convert string into int

For Loop n condition it’s alike C n C++

For more,u can open

http://www.csharp-station.com/Tutorials/

Thankz…^^