Sabtu, 03 Desember 2011

program zodiak


cara membuat program zodiak menggunakan Delphi

1.jalan kan delphi
2.aturkan tampilan formsperti di bawah ini


3.klik 2x pada button 1(proses) dan koding dibawah ini. dan jalan kan.!!!!!!!!!!!!!

procedure bintang (var tgl,bln :integer);
var print :string;
begin
if (tgl>=21) and (tgl<=31) and (bln=1) or (tgl>=1) and (tgl<=19) and (bln=2) then
begin
 showmessage('Aquarius');
end
else
if (tgl>=20) and (tgl<=29) and (bln=2) or (tgl>=1) and (tgl<=20) and (bln=3) then
begin
 showmessage('Pisces');
end
else
if (tgl>=21) and (tgl<=30) and (bln=3) or (tgl>=1) and (tgl<=20) and (bln=4) then
begin
 showmessage('Aries');
end
else
if (tgl>=21) and (tgl<=30) and (bln=4) or (tgl>=1) and (tgl<=21) and (bln=5) then
begin
 showmessage('Taurus');
end
else
if (tgl>=22) and (tgl<=31) and (bln=5) or (tgl>=1) and (tgl<=21) and (bln=6) then
begin
 showmessage('Gemini');
end
else
if (tgl>=22) and (tgl<=30) and (bln=6) or (tgl>=1) and (tgl<=22) and (bln=7) then
begin
 showmessage('Cancer');
end
else
if (tgl>=23) and (tgl<=31) and (bln=7) or (tgl>=1) and (tgl<=22) and (bln=8) then
begin
 showmessage('Leo');
end
else
if (tgl>=23) and (tgl<=31) and (bln=8) or (tgl>=1) and (tgl<=25) and (bln=9) then
begin
 showmessage('Virgo');
end
else
if (tgl>=26) and (tgl<=30) and (bln=9) or (tgl>=1) and (tgl<=23) and (bln=10) then
begin
 showmessage('Libra');
end
else
if (tgl>=24) and (tgl<=31) and (bln=10) or (tgl>=1) and (tgl<=22) and (bln=11) then
begin
 showmessage('Scorpio');
end
else
if (tgl>=23) and (tgl<=30) and (bln=11) or (tgl>=1) and (tgl<=21) and (bln=12) then
begin
 showmessage('Sagitarius');
end
else
if (tgl>=22) and (tgl<=31) and (bln=12) or (tgl>=1) and (tgl<=20) and (bln=1) then
begin
 showmessage('Capricorn');
end
else
end;

procedure TForm1.Button1Click(Sender: TObject);
var TGL,BLN :integer;
begin
TGL := strtoint(edit1.Text );
BLN:= strtoint (edit2.Text );
bintang(TGL,BLN);


end;

end.

program pendataan mahasiswa


#include<stdio.h>
#include<conio.h>

struct mahasiswa
{
        char Nim[10];
        char Nama[20];
        char Kelas[2];
};

/*void tukar(char *a,char *b)
{
        char c;
        c=*a;
        *a=*b;
        *b=c;
}*/

void main()
{
        mahasiswa mhs[10];
        int i,data;

        printf("Masukkan banyak data(Max 10): "); scanf("%d",&data);

        for (i=0;i<data;i++)
        {
                        printf("\nData Mahasiswa ke-%d\n",i+1);
                        printf("NIM: "); scanf("%s",&mhs[i].Nim);
                        printf("Nama: "); scanf("%s",&mhs[i].Nama);
                        printf("Kelas: "); scanf("%s",&mhs[i].Kelas);
                        clrscr();
        }

        clrscr();
        puts("\n          DATA MAHASISWA INFORMATIKA");
        puts("_______________________________________________");
        puts("No.|NIM      |Nama                    |Kelas");
        puts("_______________________________________________");

       /*for (i=1;i<data;i++)
        {
                        for (j=i;j<data;j++)
                        {
                                        if (mhs[i].Nim>mhs[j].Nim)
                                        {
                                                        tukar(&mhs[i].Nim,&mhs[j].Nim);

                                                        //tukar(&mhs[i].Nama,&mhs[j].Nama);

                                                        //tukar(&mhs[i].Kelas,&mhs[j].Kelas);
                                        }
                        }
        }*/

        for (i=0;i<data;i++)
        {
                        printf("%d  | %s     |%s                      |%s\n",i+1,mhs[i].Nim,mhs[i].Nama,mhs[i].Kelas);
                        puts("_____________________________________________________\n");
        }
        getch();
}


TAMPILAN PROGRAM NYA


program perkalian matrik



PROGRAM PERKALIAN MENNGUKAN C++

#include<stdio.h>
void main()
{
       int n_i=2,n_j=2,n_k=1;

       int A[2][2],B[2][1],C[2][1];
       int i,j,k;
       //____________________________________
       printf("masukkan Nilai Matriks P\n");
       for (i=0;i<n_i;i++)
       {
                       for (j=0;j<n_j;j++)
                       {
                                       printf("Baris ke-%i Kolom ke-%i : ",i+1,j+1); scanf("%i",&A[i][j]);
                       }
       }
       //_______________________________________
       printf("\nmasukkan Nilai Matriks Q\n");
       for (j=0;j<n_j;j++)
       {
                       for (k=0;k<n_k;k++)
                       {
                                       printf("Baris ke-%i Kolom ke-%i : ",j+1,k+1); scanf("%i",&B[j][k]);
                       }
       }
       //_________________________________________
       printf("\nPerhitungan sedang dilakukan...");
       for (i=0;i<n_i;i++)
       {
                       for (k=0;k<n_k;k++)
                       {
                                       C[i][k]=0;
                                       for (j=0;j<n_j;j++)
                                       {
                                                       C[i][k]=C[i][k]+A[i][j]*B[j][k];
                                       }
                       }
       }

       printf("\n");
       printf("\nhasil kali matrik P & matrik Q atau matrik R:\n");
       for (i=0;i<n_i;i++)
       {
                       for (k=0;k<n_k;k++)
                       {
                                       printf("|%i|",C[i][k]);
                       }
                       printf("\n");
       }
}