Photobucket Photobucket

Pendidikan Indonesia MAJU dan JAYA

Majukan Pendidikan Indonesia, jangan biarkan siswa siswi sampai putus sekolah, tuntaskan sekolah 12 tahun, bantu mereka mendapatkan pendidikan yang layak dan bermutu.

Belajar bersama mengenai Jaringan komputer dan Ilmu IT

Belajar bersama mengenai teknik komputer jaringan, operating system, hardware, software, RPL, Editing dan banyak mengenai ilmu IT.

Roborovski, Campbell, Winter White dan Syirian 3

Mari lestarikan hamster, hamster yang lucu jangan hanya sebagai makan reptil, tapi kita pelihara dan jadikan hewan kesayangan.

Menuju keluarga yang sakinah mawadah warohmah

Sayangi keluarga, ciptakan keluarga yang tenang, saling mengasihi, saling peduli, jadikan keluarga lebih bermutu dan mengutamakan iman dan taqwa kepada Allah SWT. semoga Allah SWT selalu memberi lindungan pada keluarga kita. amin

STOP korupsi di Indonesia

Stop Korupsi mulai dari diri sendiri sampai ke penjuru Indonesia, jangan buat indonesia terus menerus terpuruk akibat memperkaya diri sendiri atau kelompok tertentu. STOP Korupsi.

Tampilkan postingan dengan label Program. Tampilkan semua postingan
Tampilkan postingan dengan label Program. Tampilkan semua postingan

Selasa, 02 Agustus 2011

Linear Search Program using C#

This is sample program to search a element from a given array of elements. linear search algorithm search a element in linear fashion and if element found just break the loop.










Code for Linear Search:

using System;
using System.Text;
using System.Collections;
using System.Data;
namespace Console_App
{
public class clsLinearSearch
{
public static void Main()
{
try
{
int[] SearchArray = new int[200];
Console.WriteLine("Program for Linear Search");
Console.WriteLine("Enter number of elements of searching array?");
int NumberCount = Convert.ToInt32(Console.ReadLine());
Console.WriteLine(" ");
Console.WriteLine("\nEnter integer searching array elements \n");
for (int i = 0; i < NumberCount; i++)
{
SearchArray[i] = Convert.ToInt32(Console.ReadLine());
}
Console.WriteLine("Enter element to search:\n");
int NumbertoSearch = Convert.ToInt32(Console.ReadLine());

for (int i = 0; i < NumberCount; i++)
{
if (SearchArray[i] == NumbertoSearch)
{
Console.WriteLine(" ");
Console.WriteLine("Congratulations: Element {0} found at location {1}\n", NumbertoSearch, i + 1);
Console.ReadLine();
return;
}
}
Console.WriteLine("Sorry: Search unsuccessful");
}
catch (Exception ex)
{
//handle exception here
}
Console.ReadLine();

}
}
}

Minggu, 24 Juli 2011

shorting program C#

namespace SortingNos
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Enter Numbers :");
int[] arr = new int[5];
string arr1 = "";
for (int i = 0; i < 5; i++)
{
arr1 = Console.ReadLine();
arr[i] = Convert.ToInt32(arr1);
}

int a, b, temp = 0;
Console.WriteLine();
for (a = 0; a < arr.Length; a++)
{
for(b=a+1;b< arr.Length;b++)
{
if (arr[a] > arr[b])
{
temp = arr[a];
arr[a] = arr[b];
arr[b] = temp;
}
}
Console.WriteLine(arr[a]);
}
Console.ReadLine();
}
}
}

Minggu, 03 Juli 2011

Object Oriented Programming (OOP)

Object Oriented Programming is an object-oriented programming. All data and functions within this paradigm wrapped in classes or objects.

The basic concept of object-oriented programming:
- Encapsulation:
Hiding the complexity of an object. Ensure the user an object can not change the state of an object in a way that is not feasible, only the method in which the object is given permission to access the situation.
Example: in making cakes (class) are materials that should be used like sugar. While the manufacture of sugar (the object) is there are several ways and materials that are kept secret by the manufacturer.

- Inheritance:
Inherit all the functions and properties of its parent object.
Example: The nature of the sugar (Object parent) sweet
Traits in sugarcane (Object Derivatives) sweet
If the programming parent's name is written so in writing to no longer need to double him, just the name of the derivative.

- Polymorphism:
Can have different properties and behaviors, although the function of these objects have the same name.
Example: in the real world there is only one name like a cat (class). But the only object that is a state (state) and behavior (behavior) is different.

Class and Object
In object oriented programming class there. Class is a collection of some objects. In every object there is definitely variable and method.










salam kompak seduluran : kentank :)