Program Diskon menggunakan C++
#include <iostream.h>
#include <conio.h>
main()
{
long
int kode,jmlunit;
long
double harga,diskon,sbldiskon,hargatotal,uterima,kembalian;
cout<<"-________PROGRAM
DISKON________-";
cout<<endl;
cout<<endl;
cout<<"Jumlah
Unit : "; cin>>jmlunit;
cout<<"Harga : "; cin>>harga;
sbldiskon=jmlunit*harga;
cout<<"Total
Sebelum Diskon : "<<sbldiskon<<endl;
if
((sbldiskon>25000)&&(sbldiskon<=50000))
kode=1;
if
((sbldiskon>50000)&&(sbldiskon<=75000))
kode=2;
if
((sbldiskon>75000)&&(sbldiskon<=100000))
{
kode=3;
}
else
if (sbldiskon>100000)
{
kode=4;
}
switch(kode)
{
case
1:
diskon=sbldiskon*0.25;
break;
case
2:
diskon=sbldiskon*0.3;
break;
case
3:
diskon=sbldiskon*0.5;
break;
case
4:
diskon=sbldiskon*0.75;
break;
default:
diskon=0;
}
cout<<"Kode : "<<kode<<endl;
cout<<"Diskon
: "<<diskon<<endl;
hargatotal=sbldiskon-diskon;
cout<<"Harga
Total :
"<<hargatotal<<endl;
cout<<"Uang
Diterima : "; cin>>uterima;
kembalian=uterima-hargatotal;
cout<<"Kembalian : "<<kembalian<<endl;
getch();
}semoga Bermanfaat :D
Show
0 Comments
prev
next