BERBAGAI REFERENSI DARI BEBERAPA SUMBER

Program Kasir Menggunakan Bhasa C++

#include 
#include 
#include 
int main()
{
  struct
  {
  char kobar, nabar[20];
  int harga, jumli, total, bayar, kembali;
  }brng;

  char awal, ulang;

  void main{}
  {
  clrscr();
  puts("---------------------------------------------------------------------");
  puts("*********    SELAMAT DATANG DI PROGRAM SEDERHANA DARI KASIR  ********");
  puts("*********    SELAMAT DATANG BERBELANJA DI TOKO KAMI          ********");
  puts("---------------------------------------------------------------------");
  puts("[1] Input Makanan");
  puts("[2] Input Minuman");
  puts("[3] Input Barang ");
  puts("[4] Input Kaos   ");
  puts("[5] exit");
  cout<<"Pilih Kode Menu [1/2/3/4/5] : ";cin>>awal;
if (awal=='1')
   goto satu;
  else
  if (awal=='2')
   goto dua;
  else if (awal=='3')
   goto tiga;
  else if (awal=='4')
   goto empat;
  else
   goto lima;

  satu:
  clrscr();
  puts("----------------------------------------------");
  puts("*               DAFTAR MAKANAN               *");
  puts("----------------------------------------------");
  puts("[A] Ayam Follback     ");
  puts("[B] Mendoan Jenglot   ");
  puts("[C] Mie Kuntilanak    ");
  puts("[D] Steak Ayam Pocong ");
  cout<<"Kode Barang [A/B/C/D] : ";cin>>brng.kobar;
  if (brng.kobar=='A'||brng.kobar=='a')
   {strcpy (brng.nabar, "Ayam Follback");
     brng.harga=18000;}
  else
  if (brng.kobar=='B'||brng.kobar=='b')
   {strcpy (brng.nabar, "Mendoan Jenglot");
     brng.harga=20000;}
  else
  if (brng.kobar=='C'||brng.kobar=='c')
   {strcpy (brng.nabar, "Mie Kuntilanak");
     brng.harga=15000;}
  else
   {strcpy (brng.nabar, "Steak Ayam Pocong");
     brng.harga=10000;}

puts("----------------------------------------------");
  cout<<"Nama Barang  : "<>brng.jumli;
  brng.total=brng.harga*brng.jumli;
  cout<<"Total Bayar  : Rp. "<>brng.bayar;
  brng.kembali=brng.bayar-brng.total;
  cout<<"Uang Kembali : Rp. "<>ulang;
  if (ulang=='Y'||ulang=='y')
   goto satu;
  else
   goto awal;

  dua:
  clrscr();
  puts("----------------------------------------------");
  puts("*               DAFTAR MINUMAN               *");
  puts("----------------------------------------------");
  puts("[A] Es Pocong Original  ");
  puts("[B] Es Pocong Strowberry");
  puts("[C] Es Kolor Ijo Melon  ");
  puts("[D] Es Kuntilanak Jeruk ");
  cout<<"Kode Barang [A/B/C/D] : ";cin>>brng.kobar;
  if (brng.kobar=='A'||brng.kobar=='a')
   {strcpy (brng.nabar, "Es Pocong Original");
     brng.harga=7000;}
  else
  if (brng.kobar=='B'||brng.kobar=='b')
   {strcpy (brng.nabar, "Es Pocong Strowberry");
     brng.harga=7000;}
  else
  if (brng.kobar=='C'||brng.kobar=='c')
   {strcpy (brng.nabar, "Es Kolor Ijo Melon");
     brng.harga=5000;}
  else
   {strcpy (brng.nabar, "Es Kuntilanak Jeruk");
     brng.harga=6000;}

puts("----------------------------------------------");
  cout<<"Nama Barang  : "<>brng.jumli;
  brng.total=brng.harga*brng.jumli;
  cout<<"Total Bayar  : Rp. "<>brng.bayar;
  brng.kembali=brng.bayar-brng.total;
  cout<<"Uang Kembali : Rp. "<>ulang;
  if (ulang=='Y'||ulang=='y')
   goto tiga;
  else
   goto awal;

tiga:
  clrscr();
  puts("----------------------------------------------");
  puts("*                DAFTAR BARANG               *");
  puts("----------------------------------------------");
  puts("[A] Nike");
  puts("[B] Adidas");
  puts("[C] Puma");
  puts("[D] League");
  cout<<"Kode Barang [A/B/C/D] : ";cin>>brng.kobar;
  if (brng.kobar=='A'||brng.kobar=='a')
   {strcpy (brng.nabar, "Nike");
     brng.harga=750000;}
  else
  if (brng.kobar=='B'||brng.kobar=='b')
   {strcpy (brng.nabar, "Adidas");
     brng.harga=400000;}
  else
  if (brng.kobar=='C'||brng.kobar=='c')
   {strcpy (brng.nabar, "Puma");
     brng.harga=500000;}
  else
   {strcpy (brng.nabar, "League");
     brng.harga=250000;}

puts("----------------------------------------------");
  cout<<"Nama Barang  : "<>brng.jumli;
  brng.total=brng.harga*brng.jumli;
  cout<<"Total Bayar  : Rp. "<>brng.bayar;
  brng.kembali=brng.bayar-brng.total;
  cout<<"Uang Kembali : Rp. "<>ulang;
  if (ulang=='Y'||ulang=='y')
   goto dua;
  else
   goto awal;

  empat:
  clrscr();
  puts("----------------------------------------------");
  puts("*               DAFTAR Kaos               *");
  puts("----------------------------------------------");
  puts("[A] Nike");
  puts("[B] Adidas");
  puts("[C] Ripcurl");
  puts("[D] Quicksilver");
  cout<<"Kode Barang [A/B/C/D] : ";cin>>brng.kobar;
  if (brng.kobar=='A'||brng.kobar=='a')
   {strcpy (brng.nabar, "Nike");
     brng.harga=250000;}
  else
  if (brng.kobar=='B'||brng.kobar=='b')
   {strcpy (brng.nabar, "Adidas");
     brng.harga=500000;}
  else
  if (brng.kobar=='C'||brng.kobar=='c')
   {strcpy (brng.nabar, "Ripcurl");
     brng.harga=200000;}
  else
   {strcpy (brng.nabar, "Quicksilver");
     brng.harga=150000;}

puts("----------------------------------------------");
  cout<<"Nama Barang  : "<>brng.jumli;
  brng.total=brng.harga*brng.jumli;
  cout<<"Total Bayar  : Rp. "<>brng.bayar;
  brng.kembali=brng.bayar-brng.total;
  cout<<"Uang Kembali : Rp. "<>ulang;
  if (ulang=='Y'||ulang=='y')
   goto tiga;
  else
   goto awal;

   lima:
  cout<
ini merupakan tugas kelompok AP3 thanks to http://intishar1994.wordpress.com 
 

0 komentar:

Posting Komentar