Berikut listingnya
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
main()
{
char nm_pembeli[15],no_tlp[10],kode,merk[8],ukuran,lagi;
long harga=0,total,bayar,kembalian;
int jum_beli;
awal:
cout<<"==========================================="<<endl;
cout<<"\tJAKET SERBA NYAMAN\n";
cout<<"==========================================="<<endl;
cout<<"Nama Pembeli :
";cin>>nm_pembeli;
cout<<"No.Tlp :
";cin>>no_tlp;
cout<<"Input Kode Jaket [1/2] : ";cin>>kode;
cout<<"Input Ukuran Jaket :
";cin>>ukuran;
cout<<"Input Jumlah Beli :
";cin>>jum_beli;
if (kode=='1')
{
strcpy(merk,"EIGER");
if (ukuran=='s'||ukuran=='S')
harga=150000;
if (ukuran=='m'||ukuran=='M')
harga=220000;
if(ukuran=='l'||ukuran=='L' )
harga=250000;
}
else if (kode=='2')
{
strcpy(merk,"POLO");
if (ukuran=='s'||ukuran=='S')
harga=100000;
if (ukuran=='m'||ukuran=='M')
harga=150000;
if (ukuran=='l'||ukuran=='L' )
harga=200000;
}
total=jum_beli*harga
;
clrscr();
cout<<"==========================================="<<endl;
cout<<"\tJAKET SERBA NYAMAN \n";
cout<<"==========================================="<<endl;
cout<<"Nama Pembeli :
"<<nm_pembeli;cout<<"\tNo.Tlp :
"<<no_tlp<<endl;
printf("\nPilihan Kode Jaket : ");
printf("\n\n\t1. Untuk kode Jaket EIGER");
printf("\n\t2. Untuk kode Jaket POLO ");
cout<<"\n==========================================="<<endl;
cout<<"\nKode Jaket : "<<kode<<endl;
cout<<"Ukuran (S/M/L) :
"<<ukuran<<endl;
cout<<"Jumlah Beli : "<<jum_beli<<endl;
cout<<"Merk Barang : "<<merk<<endl;
cout<<"Harga Barang : "<<harga<<endl;
cout<<"Total Bayar : "<<total<<endl;
cout<<"Bayar : ";cin>>bayar;
kembalian=bayar-total;
cout<<"Kembalian : "<<kembalian;
cout<<"\n==========================================="<<endl;
cout<<"\nINGIN INPUT LAGI [Y/T] : ";
cin>>lagi;
if (lagi == 'y' || lagi =='Y')
goto awal;
getch();
}
Berikut hasil dari listing program tersebut diatas
Layar Input dan Layar Output
Demikian contoh sederhana dari sebuah program pembelian jaket dengan Borland C++
Created by Joko Purwito on http://jokopurwito.blogspot.com
Jakarta , 23 Oktober 2013
bagus bro ,,thanks infonya
ReplyDeletemas izin copas ya program nya . sebelum dan sesudah nya saya ucapakan terimakasih. salam sukses
ReplyDelete