Kamis, 12 April 2012

C++ INPUT BARANG


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

main ()
{
float nf,hg,dis,kb,jt,th,hb,tb,jd;
atas:
clrscr();
cout << "PROGRAM MENGHITUNG HARGA BARANG \n";
cout << "================================ \n ";
cout <<"Masukan No Faktur :  ";
cin >> nf;
cout <<"Masukkan Kode Barang :  ";
cin >> kb;
if (kb>=4)
{
cout << "KODE YANG ANDA MASUKKAN SALAH"<<"\n";
  goto atas;
  getch();
 }
cout <<"Masukkan Jumlah Transaksi :  ";
cin >> jt;

if ((kb == 1 ) && (jt >= 5))
{
dis = 0.07;
hg=500000;
}
else if ((kb == 2 ) && (jt >= 5))
{
dis = 0.07;
hg=100000;
}
else if ((kb == 2 ) && (jt >= 10))
{
dis = 0.05;
hg=100000;
}
if (kb == 3 )
{
dis = 0;
hg=50000;
}
else if ((kb == 1 ) && (jt <= 4))
{
dis = 0;
hg=500000;
}
else if ((kb == 2 ) && (jt <= 4))
{
dis = 0;
hg=100000;
}



 //cout<<setprecision(6);
cout<<"Harga Barang : Rp. "<<hg<<",-"<<"\n";
th=jt*hg;

cout<<"Total Harga : Rp. "<<th<<",-"<<"\n";
jd=th*dis;
cout<<"Diskon : Rp. "<<jd<<",-"<<"\n";
tb=th-jd;
cout<<"Total Bayar : Rp. "<<tb<<",-"<<"\n";
getch();
}

Tidak ada komentar: