Program struktur data penjualan rokok



#include
#include
#include
using namespace std ;
void proses_data(void);
void rokok(void);
void shampo(void);
void detergen(void);
void mie(void);
void sabun_mandi(void);
void pasta(void);
void minuman(void);
void lampu(void);
void input_data(void);
void input_lagi(void);
char data[10][30]={"rokok", "obat keramas", "detergen", "mie", "sabun mandi", "gigi", "penyegar dahaga", "lampu"};
char cari[30];
char pilih, pilih1;
int low, high, posisi;
float posisi1;
int N=8, flag=0;
char jwb;
int total,bayar,kembali,jml,H1,H2,H3;
int ares16=5000, ares12=4000, aresmerah=4400, pantene=500, sunsilk=500, clear=500;
int attackK=500, attackB=1000, rinsoK=500, sedapG=1600, sedapS=1500, indomieG=1600;
int lux=2500, harmony=1600, lifeboy=2400, pepsodent=3500, pepsodentH=7500, kodomo=4700;
int nutrisari=1000, tehS=500, sariwangiB=1000, dopB=2000, dopK=1500, dop10=2500;
main(){
cout<<"____________________________________________________________\n";
cout<<" Pencarian Barang di Toko Wahyu \n";
cout<<"______________________________________________________________\n";
cout<<"PILIHAN BARANG : \n";
cout<<" - rokok :r \n";
cout<<" - sampo :o \n";
cout<<" - detergen :d \n";
cout<<" - mie :m \n";
cout<<" - sabun :s \n";
cout<<" - pasta gigi :g \n";
cout<<" - minuman :p \n";
cout<<" - lampu :l \n";
cout<<<"Masukkan nama barang yang anda ingin lihat : ";cin>>cari;
cout<<<<"______________________________________________________________\n";
cout<<" TERIMA KASIH \n";
cout<<"______________________________________________________________\n";
getch();
}
void proses_data()
{
low=0, high=N-1;
do{
posisi1 = (*cari - *data[low]) / (*data[high]-*data[low]) * (high-low) + low;
posisi = floor(posisi1);
if(*data[posisi] == *cari){
flag = 1;
break;
}
if(*data[posisi] > *cari) high = posisi-1;
else if(*data[posisi] < *cari) low = posisi+1;
}
while(*cari >= *data[low] && *cari<= *data[high]);
if(flag==1){
cout<<"barang Ditemukan\n";
cout<<<"Apa anda ingin melihat detail "<<<"?"<<<"pilih y/t : ";cin>>pilih;
cout<<<"rokok : \n";
rokok();
cout<<<"shampo : \n";
shampo();
cout<<<"detergen : \n";
detergen();
cout<<<"mie : \n";
mie();
cout<<<"sabun mandi : \n";
sabun_mandi();
cout<<<"pasta gigi : \n";
pasta();
cout<<<"minuman : \n";
minuman();
cout<<<"lampu : \n";
lampu();
cout<<<<"Bukan Pilihan y atau t";
break;
}
}
else{
cout<<"barang Tidak Ditemukan\n";
cout<<<" |----+--------------------------+------------------|\n";
cout<<" |NO | ROKOK | HARGA |\n";
cout<<" |----+--------------------------+------------------|\n";
cout<<" |A1. |Ares slim 16 | RP. 5.000 |\n";
cout<<" |A2. |Ares slim 12 | RP. 4.000 |\n";
cout<<" |A3. |Ares merah | RP. 4.400 |\n";
cout<<" |----+--------------------------|------------------|\n";
}
cout<<"Apakah anda ingin membeli ares slim 16?[y/t] ";cin>>jwb;
if(jwb=='y'){
cout<<"Anda membeli ares slim 16, anda mau beli berapa bungkus? ";
cin>>jml;
H1=jml*ares16;
cout<<"\n";
}
else{
cout<<"Anda tidak beli\n";
}
cout<<"Apakah anda ingin membeli ares slim 12?[y/t] ";cin>>jwb;
if(jwb=='y'){
cout<<"Anda membeli ares slim 12, anda mau beli berapa bungkus? ";
cin>>jml; H2=jml*ares12;
cout<<"\n";
}
else{
cout<<"Anda tidak beli\n";
}
cout<<"Apakah anda ingin membeli ares merah?[y/t] ";cin>>jwb;
if(jwb=='y'){
cout<<"Anda membeli ares merah, anda mau beli berapa bungkus? ";
cin>>jml; H3=jml*aresmerah;
cout<<"\n";
}
else{
cout<<"Anda tidak beli\n";
}
total=H1+H2+H3;
cout<<"Anda harus membayar Rp : "<<<<"Uang anda Rp : ";cin>>bayar;
if(bayar>total){
kembali=bayar-total;
cout<<"Uang anda kembali Rp : "<< kembali <<<"Uang anda pas\n";
}
else{
kembali=total-bayar;
cout<<"Uang anda masih kurang Rp : "<< kembali <<<" |----+--------------------------+------------------|\n";
cout<<" |NO | SAMPO | HARGA |\n";
cout<<" |----+--------------------------+------------------|\n";
cout<<" |B1. |Pantene | RP. 500 |\n";
cout<<" |B2. |Sunsilk | RP. 500 |\n";
cout<<" |B3. |Clear | RP. 500 |\n";
cout<<" |----+--------------------------|------------------|\n";

}
cout<<"Apakah anda ingin membeli pantene?[y/t] ";cin>>jwb;
if(jwb=='y'){
cout<<"Anda membeli pantene, anda mau beli berapa banyak? ";
cin>>jml; H1=jml*pantene;
cout<<"\n";
}
else{
cout<<"Anda tidak beli\n";
}
cout<<"Apakah anda ingin membeli sunsilk?[y/t] ";cin>>jwb;
if(jwb=='y'){
cout<<"Anda membeli sunsilk, anda mau beli berapa banyak? ";
cin>>jml; H2=jml*sunsilk;
cout<<"\n";
}
else{
cout<<"Anda tidak beli\n";
}
cout<<"Apakah anda ingin membeli clear?[y/t] ";cin>>jwb;
if(jwb=='y')
{
cout<<"Anda membeli clear, anda mau beli berapa banyak? ";
cin>>jml; H3=jml*clear;
cout<<"\n";
}
else{
cout<<"Anda tidak beli\n";
}
total=H1+H2+H3;
cout<<"Anda harus membayar Rp : "<< total<<<"Uang anda Rp : ";cin>>bayar;
if(bayar>total){
kembali=bayar-total;
cout<<"Uang anda kembali Rp : "<< kembali <<<"Uang anda pas\n";
}
else{
kembali=total-bayar;
cout<<"Uang anda masih kurang Rp : "<< kembali <<<" |----+--------------------------+------------------|\n";
cout<<" |NO | DETERGEN | HARGA |\n";
cout<<" |----+--------------------------+------------------|\n";
cout<<" |C1. |Attack kecil | RP. 500 |\n";
cout<<" |C2. |Attack besar | RP. 1.000 |\n";
cout<<" |C3. |Rinso kecil | RP. 500 |\n";
cout<<" |----+--------------------------|------------------|\n";
}
cout<<"Apakah anda ingin membeli attack kecil?[y/t] ";cin>>jwb;
if(jwb=='y'){
cout<<"Anda membeli attack kecil, anda mau beli berapa banyak? ";
cin>>jml; H1=jml*attackK;
cout<<"\n";
}
else{
cout<<"Anda tidak beli\n";
}
cout<<"Apakah anda ingin membeli attack besar?[y/t] ";cin>>jwb;
if(jwb=='y'){
cout<<"Anda membeli attack besar, anda mau beli berapa banyak? ";
cin>>jml; H2=jml*attackB;
cout<<"\n";
}
else{
cout<<"Anda tidak beli\n";
}
cout<<"Apakah anda ingin membeli rinso kecil?[y/t] ";cin>>jwb;
if(jwb=='y')
{
cout<<"Anda membeli rinso kecil, anda mau beli berapa banyak? ";
cin>>jml; H3=jml*rinsoK;
cout<<"\n";
}
else{
cout<<"Anda tidak beli\n";
}
total=H1+H2+H3;
cout<<"Anda harus membayar Rp : "<< total<<<"Uang anda Rp : ";cin>>bayar;
if(bayar>total){
kembali=bayar-total;
cout<<"Uang anda kembali Rp : "<< kembali <<<"Uang anda pas\n";
}
else{
kembali=total-bayar;
cout<<"Uang anda masih kurang Rp : "<< kembali <<<" |----+--------------------------+------------------|\n";
cout<<" |NO | MIE | HARGA |\n";
cout<<" |----+--------------------------+------------------|\n";
cout<<" |D1. |Sedap goreng | RP. 1.500 |\n";
cout<<" |D2. |Sedap soto | RP. 1.500 |\n";
cout<<" |D3. |Indomie goreng | RP. 1.500 |\n";
cout<<" |----+--------------------------|------------------|\n";
}
cout<<"Apakah anda ingin membeli mie sedap goreng?[y/t] ";cin>>jwb;
if(jwb=='y'){
cout<<"Anda membeli mie sedap goreng, anda mau beli berapa bungkus? ";
cin>>jml; H1=jml*sedapG;
cout<<"\n";
}
else{
cout<<"Anda tidak beli\n";
}
cout<<"Apakah anda ingin membeli mie sedap soto?[y/t] ";cin>>jwb;
if(jwb=='y'){
cout<<"Anda membeli mie sedap soto, anda mau beli berapa bungkus? ";
cin>>jml; H2=jml*sedapS;
cout<<"\n";
}
else{
cout<<"Anda tidak beli\n";
}
cout<<"Apakah anda ingin membeli mie indomie goreng?[y/t] ";cin>>jwb;
if(jwb=='y'){
cout<<"Anda membeli mie indomie goreng, anda mau beli berapa bungkus? ";
cin>>jml; H3=jml*indomieG;
cout<<"\n";
}
else{
cout<<"Anda tidak beli\n";
}
total=H1+H2+H3;
cout<<"Anda harus membayar Rp : "<< total<<<"Uang anda Rp : ";cin>>bayar;
if(bayar>total){
kembali=bayar-total;
cout<<"Uang anda kembali Rp : "<< kembali <<<"Uang anda pas\n";
}
else{
kembali=total-bayar;
cout<<"Uang anda masih kurang Rp : "<< kembali <<<" |----+--------------------------+------------------|\n";
cout<<" |NO | SABUN | HARGA |\n";
cout<<" |----+--------------------------+------------------|\n";
cout<<" |E1. |Lux | RP. 2.500 |\n";
cout<<" |E2. |Harmony | RP. 1.600 |\n";
cout<<" |E3. |Lifeboy | RP. 2.400 |\n";
cout<<" |----+--------------------------|------------------|\n";
}
cout<<"Apakah anda ingin membeli sabun lux?[y/t] ";cin>>jwb;
if(jwb=='y'){
cout<<"Anda membeli sabun lux, anda mau beli berapa buah? ";
cin>>jml; H1=jml*lux;
cout<<"\n";
}
else{
cout<<"Anda tidak beli\n";
}
cout<<"Apakah anda ingin membeli sabun harmony?[y/t] ";cin>>jwb;
if(jwb=='y'){
cout<<"Anda membeli sabun harmony, anda mau beli berapa buah? ";
cin>>jml; H2=jml*harmony;
cout<<"\n";
}
else{
cout<<"Anda tidak beli\n";
}
cout<<"Apakah anda ingin membeli sabun lifeboy?[y/t] ";cin>>jwb;
if(jwb=='y'){
cout<<"Anda membeli sabun lifeboy, anda mau beli berapa buah? ";
cin>>jml; H3=jml*lifeboy;
cout<<"\n";
}
else{
cout<<"Anda tidak beli\n";
}
total=H1+H2+H3;
cout<<"Anda harus membayar Rp : "<< total<<<"Uang anda Rp : ";cin>>bayar;
if(bayar>total){
kembali=bayar-total;
cout<<"Uang anda kembali Rp : "<< kembali <<<"Uang anda pas\n";
}
else{
kembali=total-bayar;
cout<<"Uang anda masih kurang Rp : "<< kembali <<<" |----+--------------------------+------------------|\n";
cout<<" |NO | PASTA GIGI | HARGA |\n";
cout<<" |----+--------------------------+------------------|\n";
cout<<" |F1. |Pepsodent | RP. 3.500 |\n";
cout<<" |F2. |Pepsodent herbal | RP. 7.500 |\n";
cout<<" |F3. |kodomo | RP. 4.700 |\n";
cout<<" |----+--------------------------|------------------|\n";
}
cout<<"Apakah anda ingin membeli pasta gigi pepsodent?[y/t] ";cin>>jwb;
if(jwb=='y'){
cout<<"Anda membeli pasta gigi pepsodent, anda mau beli berapa banyak? ";
cin>>jml; H1=jml*pepsodent;
cout<<"\n";
}
else{
cout<<"Anda tidak beli\n";
}
cout<<"Apakah anda ingin membeli pasta gigi pepsodent herbal?[y/t] ";cin>>jwb;
if(jwb=='y'){
cout<<"Anda membeli pasta gigi pepsodent herbal, anda mau beli berapa banyak? ";
cin>>jml; H2=jml*pepsodentH;
cout<<"\n";
}
else{
cout<<"Anda tidak beli\n";
}
cout<<"Apakah anda ingin membeli pasta gigi kodomo?[y/t] ";cin>>jwb;
if(jwb=='y'){
cout<<"Anda membeli pasta gigi kodomo, anda mau beli berapa buah? ";
cin>>jml; H3=jml*kodomo;
cout<<"\n";
}
else{
cout<<"Anda tidak beli\n";
}
total=H1+H2+H3;
cout<<"Anda harus membayar Rp : "<< total<<<"Uang anda Rp : ";cin>>bayar;
if(bayar>total){
kembali=bayar-total;
cout<<"Uang anda kembali Rp : "<< kembali <<<"Uang anda pas\n";
}
else{
kembali=total-bayar;
cout<<"Uang anda masih kurang Rp : "<< kembali <<<" |----+--------------------------+------------------|\n";
cout<<" |NO | MINUMAN | HARGA |\n";
cout<<" |----+--------------------------+------------------|\n";
cout<<" |G1. |Nutrisari | RP. 1.000 |\n";
cout<<" |G2. |Teh sisri | RP. 500 |\n";
cout<<" |G3. |Sariwangi bundar | RP. 1.000 |\n";
cout<<" |----+--------------------------|------------------|\n";
}
cout<<"Apakah anda ingin membeli nutrisari?[y/t] ";cin>>jwb;
if(jwb=='y'){
cout<<"Anda membeli nutrisari, anda mau beli berapa banyak? ";
cin>>jml; H1=jml*nutrisari;
cout<<"\n";
}
else{
cout<<"Anda tidak beli\n";
}
cout<<"Apakah anda ingin membeli teh sisri?[y/t] ";cin>>jwb;
if(jwb=='y'){
cout<<"Anda membeli teh sisri, anda mau beli berapa banyak? ";
cin>>jml; H2=jml*tehS;
cout<<"\n";
}
else{
cout<<"Anda tidak beli\n";
}
cout<<"Apakah anda ingin membeli sariwangi bundar?[y/t] ";cin>>jwb;
if(jwb=='y'){
cout<<"Anda membeli sariwangi bundar, anda mau beli berapa banyak? ";
cin>>jml; H3=jml*sariwangiB;
cout<<"\n";
}
else{
cout<<"Anda tidak beli\n";
}
total=H1+H2+H3;
cout<<"Anda harus membayar Rp : "<< total<<<"Uang anda Rp : ";cin>>bayar;
if(bayar>total){
kembali=bayar-total;
cout<<"Uang anda kembali Rp : "<< kembali <<<"Uang anda pas\n";
}
else{
kembali=total-bayar;
cout<<"Uang anda masih kurang Rp : "<< kembali <<<" |----+--------------------------+------------------|\n";
cout<<" |NO | LAMPU | HARGA |\n";
cout<<" |----+--------------------------+------------------|\n";
cout<<" |H1. |Dop 5 W besar | RP. 500 |\n";
cout<<" |H2. |Dop 5 W kecil | RP. 1.000 |\n";
cout<<" |H3. |Dop 10 W | RP. 500 |\n";
cout<<" |----+--------------------------|------------------|\n";
}
cout<<"Apakah anda ingin membeli lampu dop 5 W besar?[y/t] ";cin>>jwb;
if(jwb=='y'){
cout<<"Anda membeli lampu dop 5 W besar, anda mau beli berapa buah? ";
cin>>jml; H1=jml*dopB;
cout<<"\n";
}
else{
cout<<"Anda tidak beli\n";
}
cout<<"Apakah anda ingin membeli lampu dop 5 W kecil?[y/t] ";cin>>jwb;
if(jwb=='y'){
cout<<"Anda membeli lampu dop 5 W kecil, anda mau beli berapa buah? ";
cin>>jml; H2=jml*dopK;
cout<<"\n";
}
else{
cout<<"Anda tidak beli\n";
}
cout<<"Apakah anda ingin membeli lampu dop 10?[y/t] ";cin>>jwb;
if(jwb=='y'){
cout<<"Anda membeli lampu dop 10, anda mau beli berapa buah? ";
cin>>jml; H3=jml*dop10;
cout<<"\n";
}
else{
cout<<"Anda tidak beli\n";
}
total=H1+H2+H3;
cout<<"Anda harus membayar Rp : "<< total<<<"Uang anda Rp : ";cin>>bayar;
if(bayar>total){
kembali=bayar-total;
cout<<"Uang anda kembali Rp : "<<<<"Uang anda pas\n";
}
else{
kembali=total-bayar;
cout<<"Uang anda masih kurang Rp : "<<<<"Apa Anda ingin melihat lagi ?\n";
cout<<"pilih y/t : ";cin>>pilih1;
switch(pilih1){
case 'y':
input_data();
break;
case 't':
break;
default:
cout<<<"Anda salah memilih !!";
cout<<<<"Masukkan lagi nama barang yang anda ingin lihat : ";cin>>cari;
cout<

BEGUNDELZ MANIAC. Diberdayakan oleh Blogger.