#include <iostream.h>
#include <conio.h>
char nama[20];
int harga, jml;
int total, tb, byr;
float diskon, kembali, dp;
menu();
komputer();
keyboard();
mouse();
main()
{
menu();
}
menu()
{
int pil;
char ulang;
ulang='y';
do
{
clrscr();
cout<<"*************************************"<<endl;
cout<<"<<< MENU UTAMA >>>"<<endl;
cout<<"1. Komputer"<<endl;
cout<<"2. Keyboard"<<endl;
cout<<"3. Mouse"<<endl;
cout<<"Masukkan Pilihan Anda [1 ,2 ,atau 3] : ";cin>>pil;
cout<<"*************************************"<<endl;
if(pil==1)
{
komputer();
}
else if(pil==2)
{
keyboard();
}
else if(pil==3)
{
mouse();
}
else {
cout<<"pilihan yang anda masukkan salah!"<<endl;
}
cout<<"\n\n\n\nmau mengulang ? "<<endl;
cout<<"tekan Y atau y untuk YA"<<endl;
cout<<"tekan T atau t untuk TIDAK"<<endl;
cout<<"tentukan pilihan anda SEKARANG : ";
cin>>ulang;
}
while ((ulang=='Y') || (ulang=='y'));
return 0;
}
komputer()
{
clrscr();
cout<<"* Nama Barang : Komputer "<<endl;
harga = 650000;
cout<<"* Harga = Rp 650.000,-";
cout<<"\n* Jumlah Barang = ";cin>>jml;
total = jml * harga;
cout<<"\n* Total Harga = "<<jml*harga;
if (total>800000)
{
diskon = 0.15;
cout<<"\nDiskon = 15%";
}
else if (total>700000)
{
cout<<"\nDiskon = 10%";
diskon = 0.1;
}
else
{cout<<"\nDiskon = 0";
diskon=1;
}
dp=total*diskon;
cout<<"\nDiskon Rupiah = "<<dp;
tb=total-dp;
cout<<"\n***************************";
cout<<"\nTotal Bayar = "<<tb;
cout<<"\nYang Dibayar = ";cin>>byr;
kembali=tb-byr;
cout<<"\n***************************";
cout<<"\nKembalian = "<<kembali;
return 0;
}
keyboard()
{
clrscr();
cout<<"* Nama Barang : Keyboard "<<endl;
harga = 35000;
cout<<"\n* Harga = Rp 35.000,-";
cout<<"\n* Jumlah Barang = ";cin>>jml;
total = jml * harga;
cout<<"\n* Total Harga = "<<jml*harga;
if (total>800000)
{
diskon = 0.15;
cout<<"\nDiskon = 15%";
}
else if (total>700000)
{
cout<<"\nDiskon = 10%";
diskon = 0.1;
}
else
{cout<<"\nDiskon = 0";
diskon=1;
}
dp=total*diskon;
cout<<"\nDiskon Rupiah = "<<dp;
tb=total-dp;
cout<<"\n***************************";
cout<<"\nTotal Bayar = "<<tb;
cout<<"\nYang Dibayar = ";cin>>byr;
kembali=tb-byr;
cout<<"\n***************************";
cout<<"\nKembalian = "<<kembali;
return 0;
}
mouse()
{ clrscr();
cout<<"* Nama Barang : Mouse "<<endl;
harga = 15000;
cout<<"\n* Harga = Rp 15.000,-";
cout<<"\n* Jumlah Barang = ";cin>>jml;
total = jml * harga;
cout<<"\n* Total Harga = "<<jml*harga;
if (total>800000)
{
diskon = 0.15;
cout<<"\nDiskon = 15%";
}
else if (total>700000)
{
cout<<"\nDiskon = 10%";
diskon = 0.1;
}
else
{cout<<"\nDiskon = 0";
diskon=1;
}
dp=total*diskon;
cout<<"\nDiskon Rupiah = "<<dp;
tb=total-dp+1;
cout<<"\n***************************";
cout<<"\nTotal Bayar = "<<tb;
cout<<"\nYang Dibayar = ";cin>>byr;
kembali=tb-byr;
cout<<"\n***************************";
cout<<"\nKembalian = "<<kembali;
return 0;
}
#include <conio.h>
char nama[20];
int harga, jml;
int total, tb, byr;
float diskon, kembali, dp;
menu();
komputer();
keyboard();
mouse();
main()
{
menu();
}
menu()
{
int pil;
char ulang;
ulang='y';
do
{
clrscr();
cout<<"*************************************"<<endl;
cout<<"<<< MENU UTAMA >>>"<<endl;
cout<<"1. Komputer"<<endl;
cout<<"2. Keyboard"<<endl;
cout<<"3. Mouse"<<endl;
cout<<"Masukkan Pilihan Anda [1 ,2 ,atau 3] : ";cin>>pil;
cout<<"*************************************"<<endl;
if(pil==1)
{
komputer();
}
else if(pil==2)
{
keyboard();
}
else if(pil==3)
{
mouse();
}
else {
cout<<"pilihan yang anda masukkan salah!"<<endl;
}
cout<<"\n\n\n\nmau mengulang ? "<<endl;
cout<<"tekan Y atau y untuk YA"<<endl;
cout<<"tekan T atau t untuk TIDAK"<<endl;
cout<<"tentukan pilihan anda SEKARANG : ";
cin>>ulang;
}
while ((ulang=='Y') || (ulang=='y'));
return 0;
}
komputer()
{
clrscr();
cout<<"* Nama Barang : Komputer "<<endl;
harga = 650000;
cout<<"* Harga = Rp 650.000,-";
cout<<"\n* Jumlah Barang = ";cin>>jml;
total = jml * harga;
cout<<"\n* Total Harga = "<<jml*harga;
if (total>800000)
{
diskon = 0.15;
cout<<"\nDiskon = 15%";
}
else if (total>700000)
{
cout<<"\nDiskon = 10%";
diskon = 0.1;
}
else
{cout<<"\nDiskon = 0";
diskon=1;
}
dp=total*diskon;
cout<<"\nDiskon Rupiah = "<<dp;
tb=total-dp;
cout<<"\n***************************";
cout<<"\nTotal Bayar = "<<tb;
cout<<"\nYang Dibayar = ";cin>>byr;
kembali=tb-byr;
cout<<"\n***************************";
cout<<"\nKembalian = "<<kembali;
return 0;
}
keyboard()
{
clrscr();
cout<<"* Nama Barang : Keyboard "<<endl;
harga = 35000;
cout<<"\n* Harga = Rp 35.000,-";
cout<<"\n* Jumlah Barang = ";cin>>jml;
total = jml * harga;
cout<<"\n* Total Harga = "<<jml*harga;
if (total>800000)
{
diskon = 0.15;
cout<<"\nDiskon = 15%";
}
else if (total>700000)
{
cout<<"\nDiskon = 10%";
diskon = 0.1;
}
else
{cout<<"\nDiskon = 0";
diskon=1;
}
dp=total*diskon;
cout<<"\nDiskon Rupiah = "<<dp;
tb=total-dp;
cout<<"\n***************************";
cout<<"\nTotal Bayar = "<<tb;
cout<<"\nYang Dibayar = ";cin>>byr;
kembali=tb-byr;
cout<<"\n***************************";
cout<<"\nKembalian = "<<kembali;
return 0;
}
mouse()
{ clrscr();
cout<<"* Nama Barang : Mouse "<<endl;
harga = 15000;
cout<<"\n* Harga = Rp 15.000,-";
cout<<"\n* Jumlah Barang = ";cin>>jml;
total = jml * harga;
cout<<"\n* Total Harga = "<<jml*harga;
if (total>800000)
{
diskon = 0.15;
cout<<"\nDiskon = 15%";
}
else if (total>700000)
{
cout<<"\nDiskon = 10%";
diskon = 0.1;
}
else
{cout<<"\nDiskon = 0";
diskon=1;
}
dp=total*diskon;
cout<<"\nDiskon Rupiah = "<<dp;
tb=total-dp+1;
cout<<"\n***************************";
cout<<"\nTotal Bayar = "<<tb;
cout<<"\nYang Dibayar = ";cin>>byr;
kembali=tb-byr;
cout<<"\n***************************";
cout<<"\nKembalian = "<<kembali;
return 0;
}
Tidak ada komentar:
Posting Komentar