Senin, 13 Mei 2013

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

#define VIDEO_INT 0x10
#define UCHAR unsigned char

void getCursorPos(UCHAR *y, UCHAR *x);
void setCursorPos(UCHAR y, UCHAR x);
void writeChar(UCHAR letter, UCHAR attr);
void writeString(UCHAR *str, UCHAR attr);

int main(void)
{
unsigned short int i, jeda;

setCursorPos(3,10);
writeString("Contoh Progress Bar", 0x0f); // Cetak String
setCursorPos(4,10);
writeString("-------------------", 0x0f); // Cetak String Garis
setCursorPos(5,10);
writeString("Waktu Jeda (maks. 3) : Detik", 0x0f); // Cetak String
setCursorPos(5,34);

scanf("%hu",&jeda);
jeda *= 100;

setCursorPos(8,10);
writeChar(0xda, 0x0f); // Cetak Sudut kiri atas
setCursorPos(8,34);
writeChar(0xbf, 0x0f); // Cetak sudut kanan atas
setCursorPos(10,10);
writeChar(0xc0, 0x0f); // Cetak sudut kiri bawah
setCursorPos(10,34);
writeChar(0xd9, 0x0f); // Cetak sudut kanan bawah
setCursorPos(9,10);
writeChar(0xb3, 0x0f); // Cetak garis tegak kiri
setCursorPos(9,34);
writeChar(0xb3, 0x0f); // Cetak garis tegak kanan

for(i=11; i<=33; i++)
{
setCursorPos(8,i);
writeChar(0xc4, 0x0f); // Cetak Character
setCursorPos(10,i); // Pindahkan kursor
writeChar(0xc4, 0x0f); // Cetak Character
}

for (i = 11; i <= 33; i++)
{
setCursorPos(9, i);
writeChar(0xdb,0x0e);
delay(jeda);
}

setCursorPos(9, 36);
writeString("SELESAI",0x0f);
getch();

return EXIT_SUCCESS;
}

void getCursorPos(UCHAR *y, UCHAR *x) // Baca posisi
{ // kursor
UCHAR row, col;

asm mov ah, 0x03; // Register AH = 3 heksadesimal
asm mov bh, 0x00; // Register BH = 0 heksadesimal
asm int VIDEO_INT; // Lakukan interupsi
asm mov row, dh; // Salin register DH ke row
asm mov col, dl; // Salin register DL ke col

*y = row; *x = col; // Salin row ke y, col ke x

return;
}

void setCursorPos(UCHAR y, UCHAR x) // Memindahkan
{ // Posisi kursor
asm mov ah, 0x02; // Register AH = 3 heksadesimal
asm mov bh, 0x00; // Register BH = 0 heksadesimal
asm mov dh, y; // Register DH = letak baris
asm mov dl, x; // Register DL = letak kolom
asm int VIDEO_INT; // Lakukan interupsi

return;
}

void writeChar(UCHAR letter, UCHAR attr) // Mencetak
{ // huruf
asm mov ah, 0x09; // Register AH = 9 heksadesimal
asm mov al, letter; // Register AL = hurufnya
asm mov bh, 0x00; // Register BH = 0 heksadesimal
asm mov bl, attr; // Register BL = warna huruf
asm mov ch, 0x00; // Register CH dan CL menentukan
asm mov cl, 0x01; // banyak pencetakan
asm int VIDEO_INT; // Lakukan interupsi

return;
}

void writeString(UCHAR *str, UCHAR attr) // Mencetak
{ // string
UCHAR x, y;

getCursorPos(&y, &x); // Simpan posisi kursor

for (; *str != '\0'; str++) // Loop sampai ditemukan
{ // NULL
if (x > 79)
{ // Jika sudah sampaikolom
y++; x = 0; // ke-80, pindah baris dan
} // pindah ke kolom ke-1

setCursorPos(y, x++); // Pindahkan posisi kursor
writeChar(*str, attr); // Cetak per karakter
}

return;
}

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

#define VIDEO_INT 0x10
#define UCHAR unsigned char

void getCursorPos(UCHAR *y, UCHAR *x);
void setCursorPos(UCHAR y, UCHAR x);
void writeChar(UCHAR letter, UCHAR attr);
void writeString(UCHAR *str, UCHAR attr);

int main(void)
{
unsigned short int i, jeda;

setCursorPos(3,10);
writeString("Contoh Progress Bar", 0x0f); // Cetak String
setCursorPos(4,10);
writeString("-------------------", 0x0f); // Cetak String Garis
setCursorPos(5,10);
writeString("Waktu Jeda (maks. 3) : Detik", 0x0f); // Cetak String
setCursorPos(5,34);

scanf("%hu",&jeda);
jeda *= 100;

setCursorPos(8,10);
writeChar(0xda, 0x0f); // Cetak Sudut kiri atas
setCursorPos(8,34);
writeChar(0xbf, 0x0f); // Cetak sudut kanan atas
setCursorPos(10,10);
writeChar(0xc0, 0x0f); // Cetak sudut kiri bawah
setCursorPos(10,34);
writeChar(0xd9, 0x0f); // Cetak sudut kanan bawah
setCursorPos(9,10);
writeChar(0xb3, 0x0f); // Cetak garis tegak kiri
setCursorPos(9,34);
writeChar(0xb3, 0x0f); // Cetak garis tegak kanan

for(i=11; i<=33; i++)
{
setCursorPos(8,i);
writeChar(0xc4, 0x0f); // Cetak Character
setCursorPos(10,i); // Pindahkan kursor
writeChar(0xc4, 0x0f); // Cetak Character
}

for (i = 11; i <= 33; i++)
{
setCursorPos(9, i);
writeChar(0xdb,0x0e);
delay(jeda);
}

setCursorPos(9, 36);
writeString("SELESAI",0x0f);
getch();

return EXIT_SUCCESS;
}

void getCursorPos(UCHAR *y, UCHAR *x) // Baca posisi
{ // kursor
UCHAR row, col;

asm mov ah, 0x03; // Register AH = 3 heksadesimal
asm mov bh, 0x00; // Register BH = 0 heksadesimal
asm int VIDEO_INT; // Lakukan interupsi
asm mov row, dh; // Salin register DH ke row
asm mov col, dl; // Salin register DL ke col

*y = row; *x = col; // Salin row ke y, col ke x

return;
}

void setCursorPos(UCHAR y, UCHAR x) // Memindahkan
{ // Posisi kursor
asm mov ah, 0x02; // Register AH = 3 heksadesimal
asm mov bh, 0x00; // Register BH = 0 heksadesimal
asm mov dh, y; // Register DH = letak baris
asm mov dl, x; // Register DL = letak kolom
asm int VIDEO_INT; // Lakukan interupsi

return;
}

void writeChar(UCHAR letter, UCHAR attr) // Mencetak
{ // huruf
asm mov ah, 0x09; // Register AH = 9 heksadesimal
asm mov al, letter; // Register AL = hurufnya
asm mov bh, 0x00; // Register BH = 0 heksadesimal
asm mov bl, attr; // Register BL = warna huruf
asm mov ch, 0x00; // Register CH dan CL menentukan
asm mov cl, 0x01; // banyak pencetakan
asm int VIDEO_INT; // Lakukan interupsi

return;
}

void writeString(UCHAR *str, UCHAR attr) // Mencetak
{ // string
UCHAR x, y;

getCursorPos(&y, &x); // Simpan posisi kursor

for (; *str != '\0'; str++) // Loop sampai ditemukan
{ // NULL
if (x > 79)
{ // Jika sudah sampaikolom
y++; x = 0; // ke-80, pindah baris dan
} // pindah ke kolom ke-1

setCursorPos(y, x++); // Pindahkan posisi kursor
writeChar(*str, attr); // Cetak per karakter
}

return;
}


Rabu, 12 Desember 2012



#include<stdio.h>
#include<iostream.h>
#include<iomanip.h>
#include<conio.h>
main()
{
int pilihan,A[3][3],B[3][3],X[3][3],i,j,k;
while(pilihan !=5)                                                                                                                                                   
{

cout<<"-------------------------------------------------------------------------\n";
cout<<"|                           Operasi Matriks 3x3                         |\n";
cout<<"-------------------------------------------------------------------------\n";
cout <<"Pilihan:\n";
cout<<"1. Inputkan matriks\n";
cout<<"2. Tampilkan matriks\n";
cout<<"3. Penjumlahan matriks\n";
cout<<"4. Pengurangan matriks\n";
cout<<"5. Selesai\n";
cout<<"Input pilihan? [1/2/3/4/5]: ";cin>>pilihan;
cout<<endl;
clrscr();

if(pilihan==1)
{

/*** Masukkan matriks A ***/
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
cout<<endl;
cout<<"Input data matriks A["<<i+1<<"]["<<j+1<<"]: ";cin>>A[i][j];
}
}

/*** Masukkan matriks B ***/
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
cout<<endl;
cout<<"Input data matriks B["<<i+1<<"]["<<j+1<<"]: ";cin>>B[i][j];
}
}
}
else if(pilihan==2)
{

/*** Cetak isi matriks A ***/
clrscr();
cout<<endl;
cout<<"2. Tampilkan matriks\n";
cout<<"*************************************\n\n";
cout<<"===> Matriks A\n";
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
cout<<setw(4)<<A[i][j];
cout<<endl;
}
cout<<endl;

/*** Cetak isi matriks B ***/
cout<<"\n===> Matriks B\n";
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
cout<<setw(4)<< B[i][j];
cout<<endl;
}
}else if(pilihan==3)
{

/*** Proses penjumlahan matriks A dan B ***/
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
X[i][j]=A[i][j]+B[i][j];
}
}

/*** Cetak hasil penjumlahan matriks A dan B ***/
clrscr();
cout<<endl;
cout<<"3. Matriks Penjumlahan A dan B\n";
cout<<"*************************************\n\n";
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
cout<<setw(4)<<X[i][j];
cout<<endl;
}
}
else if(pilihan==4)
{

/*** Proses pengurangan matriks A dan B ****/
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
X[i][j]=A[i][j]-B[i][j];
}
}

/*** Cetak hasil pengurangan matriks A dan B ***/
clrscr();
cout<<endl;
cout<<"4. Matriks Pengurangan A dan B\n";
cout<<"*************************************\n\n";
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
cout<<setw(4)<<X[i][j];
cout<<endl;
}
}
}
cout<<endl;
return 0;
}

Kamis, 29 November 2012


#include <conio.h>
#include <stdio.h>
#include <iostream.h>
#include <iomanip.h>
judul1()
{cout<<      "GEROBAK FRIED CHIKEN"<<endl;
cout<<"\n========================================="<<endl;
cout<<"  KODE      JENIS     HARGA            "<<endl;
cout<<"========================================="<<endl;}
judul2()
{cout<<      "GEROBAK FRIED CHIKEN"<<endl;
cout<<"\n================================================"<<endl;
cout<<" NO\tJenis Potong\t harga\t banyak\t jumlah"<<endl;
cout<<"\t\t\t satuan";
cout<<"\t beli";
cout<<"\t harga"<<endl;

cout<<"================================================\n"<<endl;}
main()
{
char kode[10],*jenis[10];
int i,j,harga[10],jml[10],total[10],pajak;
 long int tobay,totbay ;
judul1();
cout<<"  D    Dada      Rp.2500        "<<endl;
cout<<"  P    Paha      Rp.2000        "<<endl;
cout<<"  S    Sayap     Rp.1500        "<<endl;
cout<<"========================================="<<endl;
cout<<"\nBanyak Jenis              : ";cin>>j;
for(i=1;i<=j;i++)
{
cout<<"\nJenis Ke                  : "<<i<<endl;
cout<<"Jenis Potong[D/P/S]       : ";cin>>kode[i];
cout<<"Banyak Potong             : ";cin>>jml[i];

switch (kode[i])
{
case 'D':
case 'd':
jenis[i]="Dada";
harga[i]=2500;
break;

case 'P':
case 'p':
jenis[i]="Paha";
harga[i]=2000;
break;

case 'S':
case 's':
jenis[i]="Sayap";
harga[i]=1500;
break;
default:
jenis[i]="Belum Tersedia";
harga[i]=0;
}
total[i]=jml[i]*harga[i];
}

judul2();

for(i=1;i<=j;i++)
{
cout<<setiosflags(ios::left)<<setw(9)<<i;
cout<<setiosflags(ios::left)<<setw(5)<<kode[i];
cout<<setiosflags(ios::left)<<setw(11)<<jenis[i];
cout<<setiosflags(ios::left)<<setw(9)<<harga[i];
cout<<setiosflags(ios::left)<<setw(8)<<jml[i];
cout<<setiosflags(ios::left)<<setw(7)<<total[i]<<endl;
tobay=total[i]+tobay;
pajak=0.1*tobay;
totbay=tobay+pajak;
}
cout<<"\n=============================================="<<endl;
cout<<"\nJumlah Bayar\t\t\t\t"<<tobay<<endl;
cout<<"PPN10%\t\t\t\t\t"<<pajak<<endl;
cout<<"TOTAL BAYAR\t\t\t\t"<<totbay<<endl;
getch();
}

tugas.JPG














#include <stdio>
#include <conio>
#include <iostream>
#include <iomanip>
main(){
awal:
clrscr();
int  kode[20],kodee[20],jker[20],ko[20],lembur[20],k[20],l[20],pndptn[20];
long  pajak[20],total=0;
const g=700000;
int n,i;
char nama[20][20],nm[20][20],jbtn[10][10];
char lagi;
cout<<"========================="<<endl;
cout<<"  PT. STAY COOL"<<endl;
cout<<"========================="<<endl;

cout<<"Masukan Jumlah Karyawan    :";cin>>n;
for(i=1;i<=n;i++){
cout<<"Karyawan Ke-               :"<<i<<endl;
cout<<"Nama Karyawan              :";cin>>nama[i];
cout<<"Golongan[1/2/3]            :";cin>>kode[i];
cout<<"Pendidikan(1=SMU/2=D3/3=S1):";cin>>kodee[i];
cout<<"Jumlah Jam Kerja           :";cin>>jker[i];
cout<<endl;

if(kode[i]==1){strcpy(jbtn[i],"junior");
k[i]=0.05*g;}
else if(kode[i]==2){strcpy(jbtn[i],"senior");
k[i]=0.1*g;}
else if(kode[i]==3){strcpy(jbtn[i],"supervisor");
k[i]=0.15*g;}
if(kodee[i]==1){strcpy(nm[i],"SMU");}
if(kodee[i]==2){strcpy(nm[i],"D3");}
if(kodee[i]==3){strcpy(nm[i],"S1");}

if(jker[i]<=240){lembur[i];}
else
{ko[i]=jker[i]-240;
lembur[i]=ko[i]*2500;}
l[i]=g+k[i]+lembur[i];
pajak[i]=0.1*l[i];
pndptn[i]=l[i]-pajak[i];
total=total+pndptn[i];
}

cout<<"                         PT.STAY COOL"<<endl;
cout<<"======================================================================\n";
cout<<"\n\n No Nama\t\tTunjangan"<<endl;
cout<<"    Karyawan\t---------------------\t Honor\t\t Pendapatan\n";
cout<<"\t\tJabatan\t   Pendidikan\t Lembur\t Pajak\t Bersih";
cout<<"\n======================================================================\n";
for(i=1;i<=n;i++){
cout<<"\n"<<setiosflags(ios::left)<<" "<<setw(3)<<i;
cout<<setiosflags(ios::left)<<setw(12)<<nama[i];
cout<<setiosflags(ios::left)<<setw(13)<<jbtn[i];
cout<<setiosflags(ios::left)<<setw(12)<<nm[i];
cout<<setiosflags(ios::left)<<setw(8)<<lembur[i];
cout<<setiosflags(ios::left)<<setw(8)<<pajak[i];
cout<<setiosflags(ios::left)<<setw(9)<<pndptn[i];
cout<<endl;}
cout<<"=========================================================================";
cout<<"\t\t\t\tTotal Gaji Yang di Keluarkan  Rp. :"<<total;
   getch();}

khjsd.JPG

Rabu, 28 November 2012

Tugas Applikasi Penjualan Fried Chicken Menggunakan Java



public class Tugas {

    public static void main(String[] args) {

        Scanner input = new Scanner(System.in);
       
        System.out.println("=========GEROBAK FRIED CHIKEN==============");
        System.out.println("===========================================");
        System.out.println("No==Jenis ====Harga====Banyak====Jumlah====");
        System.out.println("====Potong====Satuan===Beli======Harga=====");
        // Untuk memasukan berapa banyak jenis yang akan dibeli
        System.out.print("Masukan Banyak Jenis ");


        int banyak_jenis = input.nextInt();

        String[] jenis = new String[banyak_jenis];
        int[] jumlah_potong = new int[banyak_jenis];
        int[] harga = new int[banyak_jenis];
        int[] jumlah_bayar = new int[banyak_jenis];
        double total_bayar = 0;
        String[] kode = new String[banyak_jenis];
       
        for (int i = 0; i < jumlah_potong.length; i++) {
            System.out.print("Masukan Jenis ");          
            jenis[i] = input.next();
            System.out.println();
            System.out.print("Jumlah Potong  = ");
            jumlah_potong[i] = input.nextInt();
            System.out.println();
        }

        // Sort
        for (int i = jumlah_potong.length - 1; i >= 1; i--) {
        // Find the maximum in the jumlah_potong[0..i]
            int currentMax = jumlah_potong[0];
            int currentMaxIndex = 0;

            for (int j = 1; j <= i; j++) {
                if (currentMax < jumlah_potong[j]) {
                    currentMax = jumlah_potong[j];
                    currentMaxIndex = j;
                }
            }

        // Swap jumlah_potong[i] dengan jumlah_potong[currentMaxIndex];
        // Swap jenis[i] dengan jenis[currentMaxIndex] ;
            if (currentMaxIndex != i) {
                jumlah_potong[currentMaxIndex] = jumlah_potong[i];
                jumlah_potong[i] = currentMax;
                String temp = jenis[currentMaxIndex];
                jenis[currentMaxIndex] = jenis[i];
                jenis[i] = temp;
            }
        }
     
        System.out.println("=========GEROBAK FRIED CHIKEN====================");      
        System.out.println("No\tJenis \tHarga\tBanyak\tJumlah\t");
        System.out.println("  \tPotong\tSatuan\tBeli\tHarga\t");
        System.out.println("=================================================");
        int no = 1;
        for (int i = 0; i < jenis.length; i++) {
            if(jenis[i].equalsIgnoreCase("Paha")){
                harga[i] = 2500;
                kode[i] = "P";
            }else if(jenis[i].equalsIgnoreCase("Sayap")){
                harga[i] = 2000;
                kode[i] = "S";
            }else {
                harga[i] = 3000;
                kode[i] = "D";
            }
            System.out.println(no+".\t"+jenis[i] +"\t"+harga[i]+"\t"+ jumlah_potong[i]+"\t Rp. "+ (jumlah_bayar[i] =(harga[i]* jumlah_potong[i])));
            total_bayar += jumlah_bayar[i];
            no++;
        }
        System.out.println("=================================================");
        System.out.println("Jumlah Bayar Rp. "+total_bayar);
        System.out.println("Pajak 10 = Rp. "+ (total_bayar * (0.1)));
        System.out.println("Total Bayar = Rp. "+ (((0.1)*total_bayar)+total_bayar));
    }
}

Silahkan konversi ke C++ untuk tugas di kampus...

Selasa, 30 Oktober 2012

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

main()
{
awal:
clrscr();
char nama[15],kode,ukuran,merk[15],lagi;
long harga=0,jml=0,diskon=0,total=0,totaldiskon=0,ppn=0,a=0,totalbayar=0,uangbayar=0,uangkembali=0;
clrscr();
cout<<"\nDISTRO BAJU\t\t\t ";
cout<<"\n---------------------------";
cout<<"\nNama Kasir : ";cin>>nama;
cout<<"Kode Baju  : ";cin>>kode;
cout<<"Ukuran     : ";cin>>ukuran;
cout<<"Jumlah     : ";cin>>jml;


if (kode=='1')
{
strcpy(merk,"H & R");
if (ukuran=='S' || ukuran =='s')
harga=50000;
else if (ukuran=='M' || ukuran =='m')
harga=75000;
else if (ukuran=='L' || ukuran =='l')
harga=100000;
}

else if (kode=='2')
{
strcpy(merk,"ADIDAS");
if (ukuran=='S' || ukuran =='s')
harga=100000;
else if (ukuran=='M' || ukuran =='m')
harga=75000;
else if (ukuran=='L' || ukuran =='l')
harga=100000;
}

else if (kode=='3')
{
strcpy(merk,"NIKE");
if (ukuran=='S' || ukuran =='s')
harga=100000;
else if (ukuran=='M' || ukuran =='m')
harga=125000;
else if (ukuran=='L' || ukuran =='l')
harga=150000;
}


else

cout<<"Salah Kode Baju"<<endl;
cout<<"\n------------------------"<<endl;
cout<<"nama                : "<<nama<<endl;
cout<<"Merk Baju           : "<<merk<<endl;
cout<<"Harga Baju          : "<<harga<<endl;
cout<<"Jumlah Beli         : "<<jml<<endl;
total=jml*harga;
cout<<"Total Beli          : "<<total<<endl;

if(jml>=60) {
diskon=0.05*total;
}

cout<<"Diskon              : "<<diskon<<endl;
totaldiskon=total-diskon;
cout<<"Total - Diskon      : "<<totaldiskon<<endl;
a=0.10*totaldiskon;
ppn=a+totaldiskon;
cout<<"Ditambah PPN 10%    : "<<ppn<<endl;

cout<<"\n------------------------"<<endl;

cout<<"Uang Bayar          : ";cin>>uangbayar;

uangkembali=uangbayar-ppn;
cout<<"Uang Kembali        : "<<uangkembali<<endl;

cout<<"\n\t\t INGIN INPUT LAGI [Y/T] : ";cin>>lagi;
if(lagi=='Y'||lagi=='y')
goto awal;
getch();
}

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

void main();
         
  { int ukuran, kode;
char kasir[20];
  float diskon = 0;
int harga  = 0;
float total_bayar = 0;
int   uang_bayar = 0;
float uang_kembali = 0;
float ppn = (float) 0.1;
int jumlah = 0;
void main()
{
cout<<"Nama Kasir : "<<endl;

cin>>kasir;
                cout<<endl;

cout<<"Kode Baju [01]/[02]/[03]: "<<endl;
cin>>kode;

cout<<"Ukuran Baju [s]/[m]/[l]: "<<endl;
cin>>ukuran ;

cout<<"Jumlah Beli (dalam pcs): "<<endl;
cin>>jumlah;

if(kode==("01")){

if(ukuran==("s")){
                            harga = 50000;
                           if(jumlah >= 60)
                                diskon =  0.05;
                            else
                                diskon = 0;
                           ppn =  ((harga*jumlah) * 0.1);
                           total_bayar = ((harga*jumlah) -( (harga*jumlah)* diskon));
                         

}else if(ukuran==("m")){
                            harga = 75000;
                             if(jumlah >= 60)
                                diskon =  0.05;
                            else
                                diskon = 0;
                         
                            ppn =  ((harga*jumlah) * 0.1);
                           total_bayar = ((harga*jumlah) -( (harga*jumlah)* diskon));
}else{
                            harga = 100000;
                             if(jumlah >= 60)
                                diskon =  0.05;
                            else
                                diskon = 0;
                         
                            ppn =   ((harga*jumlah) * 0.1);
                           total_bayar = ((harga*jumlah) -( (harga*jumlah)* diskon));
}

}
else if(kode==("02")){

if(ukuran==("S")){
                            harga = 75000;
                            if(jumlah >= 60)
                                diskon =  0.05;
                            else
                                diskon = 0;
                         
                            ppn =   ((harga*jumlah) * 0.1);
                           total_bayar = ((harga*jumlah) -( (harga*jumlah)* diskon));
}else if(ukuran==("m") ){
                            harga = 100000;
                           if(jumlah >= 60)
                                diskon =  0.05;
                            else
                                diskon = 0;
                         
                            ppn =   ((harga*jumlah) * 0.1);
                           total_bayar = ((harga*jumlah) -( (harga*jumlah)* diskon));
}else{
                            harga = 125000;
                             if(jumlah >= 60)
                                diskon =  0.05;
                            else
                                diskon = 0;
                         
                           ppn =  (float) ((harga*jumlah) * 0.1);
                           total_bayar = ((harga*jumlah) -( (harga*jumlah)* diskon))
}
else {
if(ukuran==("S") ){
                            harga = 100000;
                            if(jumlah >= 60)
                                diskon =  0.05;
                            else
                                diskon = 0;
                         
                            ppn =   ((harga*jumlah) * 0.1);
                           total_bayar = ((harga*jumlah) -( (harga*jumlah)* diskon));
}else if(ukuran==("m")){
                            harga = 125000;
                           if(jumlah >= 60)
                                diskon =  0.05;
                            else
                                diskon = 0;
                         
                            ppn =   ((harga*jumlah) * 0.1);
                           total_bayar = ((harga*jumlah) -( (harga*jumlah)* diskon));
}else{
                            harga = 150000;
                             if(jumlah >= 60)
                                diskon = (float) 0.05;
                            else
                                diskon = 0;
                         
                            ppn =   ((harga*jumlah) * 0.1);
                           total_bayar = ((harga*jumlah) -( (harga*jumlah)* diskon));
}

}
cout<<"PPN : " + ppn<<endl;
cout<<"Total Bayar : " +(total_bayar+ppn)<<endl;
cout<<"Uang Bayar  : "<<endl;
cin>>uang_bayar ;
                cout<<endl;
                uang_kembali = (uang_bayar-(total_bayar+ppn);
                cout<<"Uang Kembali  = " <<uang_kembali<<endl;
getch();


}
}

Selasa, 02 Oktober 2012

#include "iostream.h"
#include "conio.h"
void main ()
{
int a;
int t;
double L;
clrscr();
cout<<"masukan alas :";
cin>>a;
cout<<"masukan tinggi :";
cin>>t;
L=(a*t)/2;
cout<<"Luasnya adalah :"<<L;
getch();
}