ini harus lebih teliti lagi gan.
#include
#include
#include
main ()
{
int kode;
char jp[25],kkw,x;
int nominal,harga,kw;
float ml,bayar,kembali,sumbangan;
pilihan:
cout<<"= PARFUMANIA ="<cout<<"====================="<cout<<"Jenis Parfum :"<cout<<" "<cout<<"1. Bulgaria |"<cout<<"2. J-Lo |"<cout<<"3. Spalding |"<cout<<"4. Woody |"<cout<<"5. Dunhill Blue |"<cout<<" "<cout<<"PILIH KODE [1/2/3/4/5] :"; cin>>kode;
cout<cout<<"Konsentrasi wangi"<cout<<" "<cout<<"A. 40% (Rp.1000/ml)|"<cout<<"B. 70% (Rp.2000/ml)|"<cout<<" "<cout<<"PILIH KODE [A/B] :";cin>>kkw;
cout<cout<<" "<cout<<"Banyaknya/ml :";cin>>ml;
if(kode==1&&kkw=='A'||kkw=='a')
{
strcpy(jp,"Bulgaria");
kw=40;
nominal=1000;
harga=ml*nominal;
}
else if(kode==1&&kkw=='B'||kkw=='b')
{
strcpy(jp,"Bulgaria");
kw=70;
nominal=2000;
harga=ml*nominal;
}
else if(kode==2&&kkw=='A'||kkw=='a')
{
strcpy(jp,"J-Lo");
kw=40;
nominal=1000;
harga=ml*nominal;
}
else if(kode==2&&kkw=='B'||kkw=='b')
{
strcpy(jp,"J-Lo");
kw=70;
nominal=2000;
harga=ml*nominal;
}
else if(kode==3&&kkw=='A'||kkw=='a')
{
strcpy(jp,"Spalding");
kw=40;
nominal=1000;
harga=ml*nominal;
}
else if(kode==3&&kkw=='B'||kkw=='b')
{
strcpy(jp,"Spalding");
kw=70;
nominal=2000;
harga=ml*nominal;
}
else if(kode==4&&kkw=='A'||kkw=='a')
{
strcpy(jp,"Woody");
kw=40;
nominal=1000;
harga=ml*nominal;
}
else if(kode==4&&kkw=='B'||kkw=='b')
{
strcpy(jp,"Woody");
kw=70;
nominal=2000;
harga=ml*nominal;
}
else if(kode==5&&kkw=='A'||kkw=='a')
{
strcpy(jp,"Dunhill Blue");
kw=40;
nominal=1000;
harga=ml*nominal;
}
else if(kode==5&&kkw=='B'||kkw=='b')
{
strcpy(jp,"Dunhill Blue");
kw=70;
nominal=2000;
harga=ml*nominal;
}
else
{
strcpy(jp,"kode salah");
nominal=0;
harga=0;
}
cout<<" "<cout<<"Jenis Parfum :"<cout<<"Konsentrasi Wangi :"<cout<<"Banyaknya/ml :"<cout<<"HARGA :Rp."<cout<<" "<cout<<"Bayar :Rp.";cin>>bayar;
kembali=bayar-harga;
cout<<"Kembali :Rp."<cout<<" *=TERIMA KASIH=* :"<
cout<<"KEMBALI KE MENU AWAL [Y/T]:";cin>>x;
if(x=='Y'||x=='y')
{
clrscr();
goto pilihan;
}
else if(x=='T'||x=='t')
getch();
}
Sumber http://www.hendrisetiawan.com#include
#include
main ()
{
int kode;
char jp[25],kkw,x;
int nominal,harga,kw;
float ml,bayar,kembali,sumbangan;
pilihan:
cout<<"= PARFUMANIA ="<
cout<
cout<
if(kode==1&&kkw=='A'||kkw=='a')
{
strcpy(jp,"Bulgaria");
kw=40;
nominal=1000;
harga=ml*nominal;
}
else if(kode==1&&kkw=='B'||kkw=='b')
{
strcpy(jp,"Bulgaria");
kw=70;
nominal=2000;
harga=ml*nominal;
}
else if(kode==2&&kkw=='A'||kkw=='a')
{
strcpy(jp,"J-Lo");
kw=40;
nominal=1000;
harga=ml*nominal;
}
else if(kode==2&&kkw=='B'||kkw=='b')
{
strcpy(jp,"J-Lo");
kw=70;
nominal=2000;
harga=ml*nominal;
}
else if(kode==3&&kkw=='A'||kkw=='a')
{
strcpy(jp,"Spalding");
kw=40;
nominal=1000;
harga=ml*nominal;
}
else if(kode==3&&kkw=='B'||kkw=='b')
{
strcpy(jp,"Spalding");
kw=70;
nominal=2000;
harga=ml*nominal;
}
else if(kode==4&&kkw=='A'||kkw=='a')
{
strcpy(jp,"Woody");
kw=40;
nominal=1000;
harga=ml*nominal;
}
else if(kode==4&&kkw=='B'||kkw=='b')
{
strcpy(jp,"Woody");
kw=70;
nominal=2000;
harga=ml*nominal;
}
else if(kode==5&&kkw=='A'||kkw=='a')
{
strcpy(jp,"Dunhill Blue");
kw=40;
nominal=1000;
harga=ml*nominal;
}
else if(kode==5&&kkw=='B'||kkw=='b')
{
strcpy(jp,"Dunhill Blue");
kw=70;
nominal=2000;
harga=ml*nominal;
}
else
{
strcpy(jp,"kode salah");
nominal=0;
harga=0;
}
cout<<" "<
kembali=bayar-harga;
cout<<"Kembali :Rp."<
cout<<"KEMBALI KE MENU AWAL [Y/T]:";cin>>x;
if(x=='Y'||x=='y')
{
clrscr();
goto pilihan;
}
else if(x=='T'||x=='t')
getch();
}