Click tulisan smilies untuk menyertakan emotion
POSTINGAN TERBARU

Contoh program C++ Array (2)

#include<stdio.h>
#include<conio.h>
#include<iomanip.h>
#include<iostream.h>
main()
{
long i,j,n,ubay,dischrini,bnyk[5],ukem=0,pot=0,dipot=0;
char kode[20],jenis[20][40],nm_kasir[20],tgl[10],bonus[20],kabar[30],rp,lagi;
float hrg[5],jumhrg[5],jumbyr,pajak,totbyr;
awal:
clrscr();
cout<<" Nama : "; gets(nm_kasir);
cout<<" Tanggal (HH-BB-TTTT) : "; gets(tgl);
clrscr();
cout<<endl;
cout<<" Hai..."<<nm_kasir;
cout<<" Bagaimana kabar kamu?? "; gets(kabar);
cout<<" Discount hari ini untuk pembelanjaan diatas Rp50.000 berapa(%)?? "; cin>>dischrini;
clrscr();
atas:
clrscr();
cout<<" Ganti Penjaga Kasir (Y/T)?? ";cin>>lagi;
if (lagi=='Y'||lagi=='y')
goto awal;
if (lagi=='T'||lagi=='t')
goto sama;
sama:
clrscr();
cout<<" Penjaga kasir hari ini adalah "<<nm_kasir<<endl;
cout<<" Discount hari ini >50rb adalah "<<dischrini;
cout<<" %"<<endl;
cout<<" ============================="<<endl;
cout<<" ||         TOKO KURNIA IBU                   ||"<<tgl;
cout<<" ||                                                               ||"<<endl;
cout<<" ============================="<<endl;
cout<<" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
cout<<" | JENIS BARANG ALAT TULIS |"<<endl;
cout<<" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
cout<<" | Kode Jenis        Barang              Harga"<<endl;
cout<<" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
cout<<" |     A                   Penghapus      Rp.1000   |"<<endl;
cout<<" |     B                  Ball point         Rp.1500   |"<<endl;
cout<<" |    C                   Penggaris         Rp.1500   |"<<endl;
cout<<" |     D                   Rautan            Rp.2000  |"<<endl;
cout<<" |     E                   Buku tls 32      Rp.2000  |"<<endl;
cout<<" |     F                   Buku tls 52      Rp.3500  |"<<endl;
cout<<" |     G                   Buku Gbr K    Rp.2000  |"<<endl;
cout<<" |     H                   Buku Gbr S     Rp.3500  |"<<endl;
cout<<" |     I                    Buku Gbr B     Rp.5000  |"<<endl;
cout<<" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl<<endl;
cout<<" Banyak jenis Barang :",cin>>n;
for(i=1;i<=n;i++)
{
cout<<" *************************\n"<<endl;
cout<<" Jenis Ke : "<<i<<endl;
cout<<" Kode Barang : ",cin>>kode[i];
cout<<" Banyak Beli : ",cin>>bnyk[i];
switch(kode[i])
{case'A': case'a':
{strcpy(jenis[i],"\t Penghapus");
hrg[i]=1000;}
break;
case'B': case 'b':
{strcpy(jenis[i],"\t Ball point");
hrg[i]=1500;}
break;
case'C': case'c':
{strcpy(jenis[i],"\t Penggaris");
hrg[i]=1500;}
break;
case'D': case'd':
{strcpy(jenis[i],"\t Rautan");
hrg[i]=2000;}
break;
case'E': case'e':
{strcpy(jenis[i],"\t Buku tls 32");
hrg[i]=2000;}
break;
case'F': case'f':
{strcpy(jenis[i],"\t Buku tls 52");
hrg[i]=3500;}
break;
case'G': case'g':
{strcpy(jenis[i],"\t Buku Gbr K");
hrg[i]=2000;}
break;
case'H': case'h':
{strcpy(jenis[i],"\t Buku Gbr S");
hrg[i]=3500;}
break;
case'I': case'i':
{strcpy(jenis[i],"\t Buku Gbr B");
hrg[i]=5000;}
break;
default: {strcpy(jenis[i],"\t Kode Salah");
hrg[i]=0;}
break;
}
jumhrg[i]=bnyk[i]*hrg[i];
}
cout<<endl;
clrscr();
cout<<endl;
cout<<"<============================================>"<<endl;
cout<<" ||                          TOKO KURNIA IBU "<<tgl<<endl;
cout<<"<============================================>"<<endl;
cout<<" | Penjaga kasir hari ini adalah "<<nm_kasir<<endl;
cout<<" | Discount hari ini >50rb adalah "<<dischrini;
cout<<" %"<<endl;
cout<<" _________________________________________________"<<endl;
cout<<" | | | | | |"<<endl;
cout<<" | No.   | Jenis                  | Harga        | Banyak      | Jumlah      |"<<endl;
cout<<" |          | Barang               | Satuan      | Beli            | Harga       |"<<endl;
cout<<" |_____|_____________|_________|_________|_________|\n"<<endl;
for(i=1;i<=n;i++)
{
cout<<setiosflags(ios::right)<<setw(5)<<i;
cout<<setiosflags(ios::left)<<setw(16)<<jenis[i];
cout<<setiosflags(ios::left)<<setw(10)<<hrg[i];
cout<<setiosflags(ios::left)<<setw(10)<<bnyk[i];
cout<<jumhrg[i]<<endl;
jumbyr=jumbyr+jumhrg[i];
}
if(jumbyr>=25000)
{
strcpy(bonus,"penggaris");
}
else if(jumbyr<25000)
{
strcpy(bonus,"Sorry U not Lucky now");
}
{
if(jumbyr>=50000)
pot=jumbyr*dischrini/100;
else if (jumbyr<50000)
pot=0;
}
dipot=jumbyr-pot;
cout<<" |_________________________________________________|\n"<<endl;
cout<<" \t\t Jumlah :Rp. "<<jumbyr<<endl;
cout<<" \t\t Diskon >50rb :Rp. "<<pot<<endl;
cout<<" \t\t Jumlah bayar :Rp. "<<dipot<<endl;
cout<<" \t\t Uang Bayar :Rp. ";cin>>ubay;
ukem=ubay-dipot;
cout<<" \t\t Uang Kembalian :Rp. "<<ukem<<endl;
cout<<" \t\t Bonus :"<<bonus<<endl<<endl<<endl<<endl<<endl;
cout<<" TERIMA KASIH TELAH BERBELANJA DI TOKO KURNIA IBU"<<endl;
cout<<" &"<<endl;
cout<<" SELAMAT DATANG KEMBALI"<<endl<<endl<<endl<<endl;
cout<<"Penghitungan Lagi (Y/T) :";cin>>lagi;
if (lagi=='Y'||lagi=='y')
goto atas;
if (lagi=='T'||lagi=='t')
goto selesai;
getch();
selesai:
}

Lengkapnya dari file diatas : Download
Share on :

0 komentar:

Posting Komentar

 
© Copyright Fine - Perfect 2011 - Some rights reserved | Powered by Blogger.com.
Template Design by Perfect Blog's