Contoh Program Aplikasi Penjualan (Parfum) Menggunakan Program Borland C++ ini ialah rujukan kiprah kelompok aku dikala memenuhi mata kuliah algoritma dan pemrograman. Program ini tidak mengecewakan sedikit rumit dengan pilihan 3 variasi. Ketika membeli parfum, pembeli mengharuskan menentukan brand parfum, banyaknya (dalam ml) dan konsentrasi wanginya.
Ikuti langkah langkah berikut :
1. buka aplikasi borland C++
2. PIlih file > New > text edit
3. Pastekan koding berikut :
#include<stdio.h>
#include<conio.h>
#include<iostream.h>
main ()
{
int kode;
char jp[25],kkw,x;
int nominal,harga,kw;
float ml,bayar,kembali,sumbangan;
pilihan:
cout<<"= PARFUMANIA ="<<endl;
cout<<"====================="<<endl;
cout<<"Jenis Parfum :"<<endl;
cout<<" "<<endl;
cout<<"1. Bulgaria |"<<endl;
cout<<"2. J-Lo |"<<endl;
cout<<"3. Spalding |"<<endl;
cout<<"4. Woody |"<<endl;
cout<<"5. Dunhill Blue |"<<endl;
cout<<" "<<endl;
cout<<"PILIH KODE [1/2/3/4/5] :"; cin>>kode;
cout<<endl;
cout<<"Konsentrasi wangi"<<endl;
cout<<" "<<endl;
cout<<"A. 40% (Rp.1000/ml)|"<<endl;
cout<<"B. 70% (Rp.2000/ml)|"<<endl;
cout<<" "<<endl;
cout<<"PILIH KODE [A/B] :";cin>>kkw;
cout<<endl;
cout<<" "<<endl;
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<<" "<<endl;
cout<<"Jenis Parfum :"<<jp<<endl;
cout<<"Konsentrasi Wangi :"<<kw<<"%"<<endl;
cout<<"Banyaknya/ml :"<<ml<<"ml"<<endl;
cout<<"HARGA :Rp."<<harga<<endl;
cout<<" "<<endl;
cout<<"Bayar :Rp.";cin>>bayar;
kembali=bayar-harga;
cout<<"Kembali :Rp."<<kembali<<endl<<endl;
cout<<" *=TERIMA KASIH=* :"<<endl<<endl<<endl;
cout<<"KEMBALI KE MENU AWAL [Y/T]:";cin>>x;
if(x=='Y'||x=='y')
{
clrscr();
goto pilihan;
}
else if(x=='T'||x=='t')
getch();
}
#include<conio.h>
#include<iostream.h>
main ()
{
int kode;
char jp[25],kkw,x;
int nominal,harga,kw;
float ml,bayar,kembali,sumbangan;
pilihan:
cout<<"= PARFUMANIA ="<<endl;
cout<<"====================="<<endl;
cout<<"Jenis Parfum :"<<endl;
cout<<" "<<endl;
cout<<"1. Bulgaria |"<<endl;
cout<<"2. J-Lo |"<<endl;
cout<<"3. Spalding |"<<endl;
cout<<"4. Woody |"<<endl;
cout<<"5. Dunhill Blue |"<<endl;
cout<<" "<<endl;
cout<<"PILIH KODE [1/2/3/4/5] :"; cin>>kode;
cout<<endl;
cout<<"Konsentrasi wangi"<<endl;
cout<<" "<<endl;
cout<<"A. 40% (Rp.1000/ml)|"<<endl;
cout<<"B. 70% (Rp.2000/ml)|"<<endl;
cout<<" "<<endl;
cout<<"PILIH KODE [A/B] :";cin>>kkw;
cout<<endl;
cout<<" "<<endl;
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<<" "<<endl;
cout<<"Jenis Parfum :"<<jp<<endl;
cout<<"Konsentrasi Wangi :"<<kw<<"%"<<endl;
cout<<"Banyaknya/ml :"<<ml<<"ml"<<endl;
cout<<"HARGA :Rp."<<harga<<endl;
cout<<" "<<endl;
cout<<"Bayar :Rp.";cin>>bayar;
kembali=bayar-harga;
cout<<"Kembali :Rp."<<kembali<<endl<<endl;
cout<<" *=TERIMA KASIH=* :"<<endl<<endl<<endl;
cout<<"KEMBALI KE MENU AWAL [Y/T]:";cin>>x;
if(x=='Y'||x=='y')
{
clrscr();
goto pilihan;
}
else if(x=='T'||x=='t')
getch();
}
4. Running programnya, akan muncul ibarat dibawah ini :
- Pilih isyarat parrfumnya (1/2/3/4/5), kemudian enter
- Pilih konsentrasi wanginya, pilih isyarat A/B, kemudian enter
- Masukkan banyaknya parfum dalam jumlah ml, contohnya 100, kemudian enter
- Maka keluar harga yang harus dibayarkan, masukkan uang bayar, kemudian enter
- Keluar uang kembali, kemudian pilih opsi kembali ke sajian awal atau close kegiatan (Y) untuk ya, (T) untuk tidak.
5. selesai,
Demikianlah Contoh Program Aplikasi Penjualan (Parfum) Menggunakan Program C++, agar membantu ! :D Sumber http://www.hendrisetiawan.com