Beginner : "ARRAY " Statement C# (C Sharp) & Source Code

9/02/2009 |

Array Represent very important data structure in C#. array consist of some value with same data type. amount of member in a array determined array variable declaration moment. in accessing each array member, we use functioning index number as indicator of array element position. Array represent part of data type have the character of reference, where each variable of reference to certain value.

Screenshot




using System;
using System.Collections.Generic;
using System.Text;

namespace Array
{
class Program
{
static void Main(string[] args)
{
int[] score;

score = new int[10];
Console.WriteLine("Input Score");
for (int i = 0; i <= 9; i++)
{
Console.Write(" Input Score {0} :",i+1);
score[i] = int.Parse(Console.In.ReadLine());
}
Console.WriteLine("List");
for (int j = 0; j <= 9; j++)
{
Console.WriteLine("score {0}:{1} ", j + 1, score[j]);
}
Console.ReadLine();
}
}
}

SOURCE CODE HERE !
DOWNLOAD

LEAVE YOUR COMMENTS

Beginner : " SWITCH-CASE " Statement C# (C Sharp) & Source Code

|

Screenshoot




using System;
using System.Collections.Generic;
using System.Text;

namespace Switch_Case
{
class Program
{
static void Main(string[] args)
{
int a;
Console.Write("number of Day [1-7] : ");
a = int.Parse(Console.In.ReadLine());
switch (a)
{
case 1:
{
Console.Write("Sunday"); break;
}
case 2:
{
Console.Write("Monday"); break;
}
case 3:
{
Console.Write("Tuesday"); break;
}
case 4:
{
Console.Write("Thursday"); break;
}
case 5:
{
Console.Write("Wednesday"); break;
}
case 6:
{
Console.Write("Friday"); break;
}
case 7:
{
Console.Write("Saturday"); break;
}
default:
{
Console.Write("Days..??"); break;
}
}
Console.ReadLine();
}
}
}


SOURCE CODE HERE!
DOWNLOAD

LEAVE YOUR COMMENTS

Beginner : " TRY-CATCH " Statement C# (C Sharp) & Source Code

9/01/2009 |

Try-Catch Statement represent program block used to handle mistake. block of try contain program line which possible yield mistake, while block of catch contain program to catch mistake generated by block of try.

Sreenshoot



using System;
using System.Collections.Generic;
using System.Text;

namespace Try_Catch
{
class Program
{
static void Main(string[] args)
{
int a, b = 5, c = 0;
try
{
a = b / c;//zero divide
}
catch (System.Exception e)
{
Console.WriteLine(e.Message);
}
}
}
}

SOURCE CODE HERE !
DOWNLOAD !


Leave Your Comments.

Beginner : " FOR " Statement C# (C Sharp) & Source Code

8/31/2009 |

For Statement used to execute program block by repeatedly in certain range.

Screenshoot





using System;
using System.Collections.Generic;
using System.Text;

namespace For
{
class Program
{
static void Main(string[] args)
{
for(int i=1;i<=10;i++) { Console.WriteLine("Good Morning..!!"); } Console.ReadLine(); } } }
SOURCE CODE HERE !
DOWNLOAD !


Leave Your Comments.

Beginner : " WHILE " Statement C# (C Sharp) & Source Code

|

While Statement

used to execute program line in a block by repeatedly ( looping). block will executing during valuable condition true. syntax usage of while.


Sreenshoot




using System;
using System.Collections.Generic;
using System.Text;

namespace While
{
class Program
{
static void Main(string[] args)
{
int i=1;
while (i <= 10) { Console.WriteLine("Hello World "); i++; } Console.ReadLine(); } } }
SOURCE CODE HERE !
DOWNLOAD

LEAVE YOUR COMMENT.