Struktur Data ( Membuat Borland C++ ) Toko Susu Formula

Oke kali ini Saya ada Tugas Dari Ibu SISKA ( Dosen Saya) yaitu Membuat Borland C++ Dengan Ketentuan yang dipelajari diModule, saya membuat program ini dengan judul TOKO SUSU FORMULA .

Untuk Programnya 

Copy Paste ajah. Tinggalin Comment ya .


#include <stdio.h>
#include <conio.h>
#include <iostream.h>
#include <string.h>
#include <iomanip.h>

judul()
{
cout<<"                    TOKO SUSU FORMULA"<<endl;
cout<<"                        SUSUKUSUKA"<<endl;
cout<<"        JL TAMAN INDAH RAYA SEBELAH KIRI"<<endl;
cout<<"          Telp/Whatsapp : 0896 0428 0448 "<<endl;
cout<<"******************************************************"<<endl;
}

garis()
{
cout<<"======================================================"<<endl;

}

struct
{
int jumbel;
long harga,subtotal;
char kdusia[2],kdmerk[3],merk[25];
}susu[10];

int a,b;
long totbel,grand,diskon,totbay,bayar,kembali;
char program,tanggal[18],karyawan[25],pembeli[25],member,lagi,nama[25],alamat[20],profesi[10],telp[12];

sum()
{
totbel=totbel+susu[a].subtotal;
}

main()
{

atas:
clrscr();
totbel=0;
judul();
cout<<endl;
cout<<"Selamat Datang di SUSUKUSUKA.."<<endl;
cout<<"Pilihan Menu : "<<endl;
cout<<"   1. Input Data Pembelian"<<endl;
cout<<"   2. Registrasi Member"<<endl;
cout<<"   3. Keluar"<<endl;
cout<<endl;
garis();
cout<<endl;
cout<<"Pilihan Program [1/2/3] : ";program=getch();
cout<<program<<endl;
cout<<"Tekan ENTER untuk melanjutkan..";getch();

if(program=='1')goto pembelian;
else if(program=='2')goto registrasi;
else if(program=='3')goto akhir;


pembelian:
clrscr();
judul();
cout<<endl;
cout<<"INPUT DATA PEMBELIAN"<<endl;

cout<<endl;
cout<<"Jenis susu : "<<endl;
cout<<"A. Susu Anak-anak & Remaja"<<endl;
cout<<"    DNC = Dancow 400gr"<<endl;
cout<<"    BBL = Bebelac 400gr"<<endl;
cout<<"    HIL = Hilo 550gr"<<endl<<endl;
cout<<"B. Susu Dewasa"<<endl;
cout<<"    ANL = Anlene 250gr"<<endl;
cout<<"    ANM = Anmum 900gr"<<endl;
cout<<"    APT = Appeton 450gr"<<endl;
garis();
cout<<endl;
cout<<"Tanggal [DD/MM/YYYY] : ";cin>>tanggal;
cout<<"Input Nama Kasir     : ";cin>>karyawan;
cout<<"Input Nama Pembeli   : ";cin>>pembeli;
cout<<"Member [Y/T]         : ";cin>>member;
cout<<"Banyak Data          : ";cin>>b;
cout<<endl;

for(a=1;a<=b;a++)
{
 cout<<"Data Ke-"<<a<<endl;
 cout<<"Kode Usia [A/B]     : ";cin>>susu[a].kdusia;
 cout<<"Kode Merk           : ";cin>>susu[a].kdmerk;
 cout<<"Banyak Beli         : ";cin>>susu[a].jumbel;
 cout<<endl;

if(strcmp(susu[a].kdusia,"A")==0||strcmp(susu[a].kdusia,"a")==0)
 {
  if(strcmp(susu[a].kdmerk,"DNC")==0)
   {
    strcpy(susu[a].merk,"Dancow 400gr");
    susu[a].harga=35000;
   }
  else if(strcmp(susu[a].kdmerk,"BBL")==0)
   {
    strcpy(susu[a].merk,"Bebelac 400gr");
    susu[a].harga=54000;
   }
   else if(strcmp(susu[a].kdmerk,"HIL")==0)
   {
    strcpy(susu[a].merk,"Hilo 550gr");
    susu[a].harga=65000;
   }
  }
else if(strcmp(susu[a].kdusia,"B")==0||strcmp(susu[a].kdusia,"b")==0)
 {
  if(strcmp(susu[a].kdmerk,"ANL")==0)
   {
    strcpy(susu[a].merk,"Anlene 250gr");

    susu[a].harga=31000;
   }
  else if(strcmp(susu[a].kdmerk,"ANM")==0)
   {
    strcpy(susu[a].merk,"Anmum 900gr");
    susu[a].harga=240000;
   }
   else if(strcmp(susu[a].kdmerk,"APT")==0)
   {
    strcpy(susu[a].merk,"Appeton 450gr");
    susu[a].harga=196000;
   }
  }
}

clrscr();
judul();
cout<<endl;
cout<<"Tanggal      : "<<tanggal<<endl;
cout<<"Nama Kasir   : "<<karyawan<<endl;
cout<<"Nama Pembeli : "<<pembeli<<endl;
cout<<"Member       : "<<member<<endl<<endl;
garis();
cout<<"No.  Merk Susu           Harga    Banyak   Subtotal"<<endl;
cout<<"                         Satuan  Pembelian         "<<endl;
garis();
for(a=1;a<=b;a++)
{
 susu[a].subtotal=susu[a].jumbel*susu[a].harga;
 cout<<setiosflags(ios::left)<<setw(5)<<a;
 cout<<setiosflags(ios::left)<<setw(20)<<susu[a].merk;
 cout<<setiosflags(ios::left)<<setw(8)<<susu[a].harga;
 cout<<setiosflags(ios::left)<<setw(10)<<susu[a].jumbel;
 cout<<setiosflags(ios::left)<<setw(8)<<susu[a].subtotal<<endl;
 sum();
}
garis();
cout<<endl;

cout<<"\t\t\t\tTotal Bayar     : "<<totbel<<endl;
if(member=='y'||member=='Y')
diskon=0.1*totbel;
else
diskon=0;

cout<<"\t\t\t\tDiskon          : "<<diskon<<endl;
grand=totbel-diskon;
cout<<"\t\t\t\tGrand Bayar     : "<<grand<<endl;
cout<<"\t\t\t\tUang Bayar      : ";cin>>bayar;
kembali=bayar-grand;

cout<<"\t\t\t\tUang Kembali    : "<<kembali;
cout<<endl;
garis();
cout<<endl;
cout<<"Terimakasih.. "<<endl;
cout<<"Input Lagi [Y/T]? ";cin>>lagi;
if(lagi=='y'||lagi=='Y') goto atas;
else if(lagi=='t'||lagi=='T') goto akhir;

registrasi:
clrscr();
judul();
cout<<"\nINPUT REGISTRASI MEMBER"<<endl<<endl;
cout<<"Input Nama    : ";cin>>nama;
cout<<"Input Alamat  : ";cin>>alamat;
cout<<"Input Profesi : ";cin>>profesi;
cout<<"Input Telp    : ";cin>>telp;

clrscr();
judul();
cout<<"\nREGISTRASI MEMBER"<<endl;
cout<<"Nama          : "<<nama<<endl;
cout<<"Alamat        : "<<alamat<<endl;
cout<<"Profesi       : "<<profesi<<endl;
cout<<"Telp          : "<<telp<<endl<<endl;
cout<<"Input Lagi [Y/T]? ";cin>>lagi;
if(lagi=='y'||lagi=='Y') goto atas;
else if(lagi=='t'||lagi=='T') goto akhir;

akhir:
getch();
}



No comments:

Post a Comment

Pages