Tampilkan postingan dengan label Pemrograman. Tampilkan semua postingan
Tampilkan postingan dengan label Pemrograman. Tampilkan semua postingan

Sabtu, 23 April 2011

Contoh Coding dengan Bahasa Pemrograman C# Bagi Pemula

|0 komentar

using System;
using System.Windows.Forms;
using System.IO;
using System.Drawing;

class FormAndi : Form
{
Label l1    = new Label();
Label l2    = new Label();
Label l3    = new Label();
Label l4    = new Label();
Label l5    = new Label();
Label l6    = new Label();
Label l7    = new Label();
Label l8    = new Label();
Label l9    = new Label();
CheckBox c1 = new CheckBox();
CheckBox c2 = new CheckBox();
CheckBox c3 = new CheckBox();
CheckBox c4 = new CheckBox();
CheckBox c5 = new CheckBox();
CheckBox c6 = new CheckBox();
CheckBox c7 = new CheckBox();
CheckBox c8 = new CheckBox();
CheckBox c9 = new CheckBox();
CheckBox c10 = new CheckBox();
CheckBox c11 = new CheckBox();
CheckBox c12 = new CheckBox();
TextBox  t1 = new TextBox();
TextBox t2  = new TextBox();
TextBox t3  = new TextBox();
Button b1   = new Button();
Label l10   = new Label();

Contoh Coding dengan Bahasa Pemrograman C# Bagi Pemula

|0 komentar

using System;
using System.Windows.Forms;
using System.IO;
using System.Drawing;

class FormAndi : Form
{
Label l1    = new Label();
Label l2    = new Label();
Label l3    = new Label();
Label l4    = new Label();
Label l5    = new Label();
Label l6    = new Label();
Label l7    = new Label();
Label l8    = new Label();
Label l9    = new Label();
CheckBox c1 = new CheckBox();
CheckBox c2 = new CheckBox();
CheckBox c3 = new CheckBox();
CheckBox c4 = new CheckBox();
CheckBox c5 = new CheckBox();
CheckBox c6 = new CheckBox();
CheckBox c7 = new CheckBox();
CheckBox c8 = new CheckBox();
CheckBox c9 = new CheckBox();
CheckBox c10 = new CheckBox();
CheckBox c11 = new CheckBox();
CheckBox c12 = new CheckBox();
TextBox  t1 = new TextBox();
TextBox t2  = new TextBox();
TextBox t3  = new TextBox();
Button b1   = new Button();
Label l10   = new Label();

FormAndi()
{
Controls.Add(l1);
Controls.Add(l2);
Controls.Add(l3);
Controls.Add(l4);
Controls.Add(l5);
Controls.Add(l6);
Controls.Add(l7);
Controls.Add(l8);
Controls.Add(c1);
Controls.Add(c2);
Controls.Add(c3);
Controls.Add(c4);
Controls.Add(c5);
Controls.Add(c6);
Controls.Add(c7);
Controls.Add(c8);
Controls.Add(c9);
Controls.Add(c10);
Controls.Add(c11);
Controls.Add(c12);
Controls.Add(t1);
Controls.Add(t2);
Controls.Add(t3);
Controls.Add(b1);
Controls.Add(l9);
Controls.Add(l10);

WindowState = FormWindowState.Maximized;
Text        = "Aplikasi Rental VCD";
Icon        = new Icon("a.Ico");
Size          = new Size(500,500);
l1.Location   = new Point(30,10);
l1.Size       = new Size(350,40);
l1.Text       = "PROGRAM PENJUALAN RENTAL VCD";
l1.Font       = new Font("Berlin Sans FB Demi",13,FontStyle.Bold|FontStyle.Underline);
b1.Location  = new Point(10,500);
b1.Size      = new Size(80,30);
b1.Font      = new Font("Comic Sans MS",12,FontStyle.Bold);
b1.Text     = "KELUAR";

l2.Location = new Point(5,50);   
c1.Location = new Point(5,70);
c2.Location = new Point(5,90);
c3.Location = new Point(5,110);
t1.Location = new Point(5,200);
l6.Location = new Point(5,180);
l6.Text     = "Film Drama / Komedi";
l6.Font     = new Font("Comic Sans MS",10,FontStyle.Bold|FontStyle.Italic);
l6.Size     = new Size(180,20);
t1.Size     = new Size(180,140);
t1.Multiline = true;
l7.Location = new Point(200,180);
l7.Size     = new Size(80,20);
l7.Text     = "Film Action";
l7.Font     = new Font("Comic Sans MS",10,FontStyle.Bold|FontStyle.Italic);
t2.Location = new Point(200,200);
t2.Size     = new Size(180,140);
t2.Multiline = true;
l8.Location = new Point(410,180);
l8.Size     = new Size(80,20);
l8.Text     = "Film Horor";
l8.Font     = new Font("Comic Sans MS",10,FontStyle.Bold|FontStyle.Italic);
t3.Location = new Point(410,200);
t3.Size     = new Size(180,140);
t3.Multiline = true;
l2.Text     = "Jenis VCD";
c1.Text     = "Drama/Komedi";
c2.Text     = "Action";
c3.Text     = "Horor";

l3.Location = new Point(150,50);
c4.Location = new Point(150,70);
c5.Location = new Point(150,90);
c6.Location = new Point(150,110);
l3.Text     = "Bacground 1";
c4.Text     = "Merah";
c5.Text     = "Kuning";
c6.Text     = "Biru";

l4.Location = new Point(380,50);
c7.Location = new Point(380,70);
c8.Location = new Point(380,90);
c9.Location = new Point(380,110);
l4.Text     = "Bacground 2";
c7.Text     = "Coklat";
c8.Text     = "Orange";
c9.Text     = "Hijau";

l5.Location = new Point(650,50);
c10.Location = new Point(650,70);
c11.Location = new Point(650,90);
c12.Location = new Point(650,110);
l5.Text     = "Bacground 3";
c10.Text     = "Emas";
c11.Text     = "Merah Muda";
c12.Text     = "Hitam";

l9.Location = new Point(5,400);
l9.Size     = new Size(450,50);
l9.Text     = "Di Buat Oleh : Jhelvi Katiandagho Jurusan Sistem Komputer"+
                                      " Semester Empat.";
l9.Font     = new Font("Comic Sans MS",14,FontStyle.Bold);

l10.Location = new Point(680,10);
l10.Size     = new Size(150,30);
l10.Font     = new Font("Comic Sans MS",10,FontStyle.Bold);
l10.Text     = "Tgl : 12 Mei 2009";

c1.Click += new EventHandler(drama);
c2.Click += new EventHandler(action);
c3.Click += new EventHandler(horor);

c4.Click += new EventHandler(merah);
c5.Click += new EventHandler(kuning);
c6.Click += new EventHandler(biru);

c7.Click += new EventHandler(coklat);
c8.Click += new EventHandler(orange);
c9.Click += new EventHandler(hijau);

c10.Click+= new EventHandler(emas);
c11.Click += new EventHandler(merahmuda);
c12.Click += new EventHandler(hitam);
b1.Click  += new EventHandler(keluar);

}

void drama (object o,EventArgs e)
{
t1.Text = "Go 30th Year,,"+
                          "Cinderella Man,,"+
                          "Chasing Library";
}

void action (object o,EventArgs e)
{
t2.Text = "Shark Boy and Lava Girl,,"+
                          "Spy Kids,,"+
                          "Lord Of The Ring,,"+
                          "Start Wars,,"+           
                          "Matrix";
}
                         
void horor (object o,EventArgs e)
{
t3.Text = "Skull,,"+
                          "Species II,,"+
                          "Sunder Bolong,,"+
                          "Kuntil Anak,,"+
                          "Nyayian Sundel Bolong,,"+
                          "Hantu Campus STMIK";
}
/*Coding BackGround 1*/

void merah (object o,EventArgs e)
{
t1.BackColor = Color.Red;
}
void kuning (object o,EventArgs e)
{
t1.BackColor = Color.Yellow;
}
void biru (object o,EventArgs e)
{
t1.BackColor = Color.Blue;
}
/*Coding BackGround 2*/
void coklat (object o,EventArgs e)
{
t2.BackColor = Color.Brown;
}
void orange (object o,EventArgs e)
{
t2.BackColor = Color.Orange;
}
void hijau (object o,EventArgs e)
{
t2.BackColor = Color.Green;
}

/*Coding BackGround 3*/                        
void emas (object o,EventArgs e)
{
t3.BackColor = Color.Gold;
}
void merahmuda (object o,EventArgs e)
{
t3.BackColor = Color.Pink;
}
void hitam (object o,EventArgs e)
{
t3.BackColor = Color.Black;
}

/*coding keluar*/
void keluar(object o,EventArgs e)
{
MessageBox.Show("Anda Ingin Keluar,,,?");
Close();

}
[STAThread]
static void Main()
{
Application.Run(new FormAndi());
}}

 setelah barisan program diatas selesai ditulis pada notepad atau editor yang ada, langkah selanjutnya yaitu tinggal dijalankan. untuk menjalankannya disini saya menggunakan command promnt untuk menjalankan program yang ada...

PROGRAM MEMBACA ISI FILE, DENGA TAMPILAN HANYA BARIS YANG MENGANDUNG HURUF HIDUP YANG DI BACA.

|0 komentar
Haloo teman-teman, kali ini aku ada postingan contoh coding program yang lumayan manarik, barisan coding dibawah ini pernah aku buat dan praktekan ketika aku semester 4 saat masuk kelas pemrograman C, jika teman - teman ingin mempelajari bahasa pemrograman C. contoh barisan coding dibawah sangat cocok buat teman-teman.

#include<stdio.h>
int main (void){
char inputfile[100];
FILE *as;
char countener;
int j;
printf("masukan nama file (beserta lokasi file yang di simpan): ");gets(inputfile);
if((as = fopen(inputfile,"r+"))!=NULL) {
printf("\nData yang ada di (%s) tertera di bawah ini:\n",inputfile);
while(!(feof(as))) {
j++;
fgets(inputfile,120,as);
if(j % 2 != 0){
puts(inputfile);
}
}
}
fclose(as);
return 0;
}

sekian,, contoh coding diatas bisa langsung di jalankan di laptop atau komputer teman-teman...

Selasa, 12 April 2011

Source Code Penjumlahan Matrix Pada Pemrograman C

|0 komentar

tutorial kali ini saya akan membagikan kepada kawan-kawan. tentang penjumlahan matrix dengan menggunakan bahasa pemrogaman C. Source Code ini sempat aku praktekan dikelas, saat matakuliah pemrograman C dan C#.

#include<stdio.h>
int main(void) {
typedef matriks [3][3];
matriks A,B,C;
int k,i,j,a,n;
/*mengisi elemen matrik A*/
printf("mengisi elemen matrik A:\n");
for(i=0; i<3; i++){
for(j=0; j<3; j++){
   printf("input matriks : A[%i,%i]:",i,j);
   fflush(stdin); scanf("%d", &A[i][j]);
   }
}
for(i=0; i<3; i++){
for(j=0; j<3; j++){
   printf("%6d",A[i][j]);
  }
  printf("\n");
}
/*mengisi elemen matriks B*/
printf("mengisi elemen matrik B:\n");
for(i=0; i<3; i++){
for(j=0; j<3; j++){
  printf("input matrik : B[%i,%i]:", i,j);
  fflush(stdin); scanf("%d", &B[i][j]);
  }
}
for(i=0; i<3; i++){
   for(j=0 ;j<3; j++){
       printf("%6d",B[i][j]);
    }
  printf("\n");
  }
/*melakukan proses penjumlahan matrik A dan B dan menyimpanya ke dalam C*/
for(i=0; i<a; i++){
   for(j=0; j<n; j++){
     C[i][j]=0;
        for(k=0; k<a; k++){
      C[i][j] = A[i][k]+B[k][j];
  }
}
/*menampilkan hasil penjumlahan matrik di atas*/
printf("\nhasil dari penjumlahan matrik A dan B:\n");
for(i=0; i<3; i++){
   for(j=0; j<3; j++){
      printf("%6d",i,j, C[i][j]);
    }
  printf("\n");
 }
 }
printf("\n");
return 0;
}

Semoga barisan coding diatas dapat bermanfaat bagi kawan-kawan yang ingin mempelajari bahasa pemrograman C. Barisan coding diatas masih dapat dikatan sederhana tapi sangat cocok bagi teman-teman yang masih awam dalam belajar bahasa pemrograman C..Terima Kasih..