Monday, January 27, 2014

SINTAK C++ SAAT UAS SEMESTER 1

#include "conio.h"
#include "stdio.h"
#include "iostream.h"
#include "iomanip.h"

garis(){
cout<<"\t_=================================_"<<endl;
}

main()
{

char no[8],nama[10],kode[8][10],jenis[8][10],lagi;
int i,in,harga[8],jml_pesan[8],subtotal[8];
float ttl_bayar,bayar,kembali;
awal:
clrscr();

cout<<"\t\tDelivery Pizza LaPizza "<<endl;
garis();
cout<<endl;
cout<<"No Pesan\t : ";cin>>no;
cout<<"Nama Pemesan\t : ";gets(nama);
cout<<"Banyak Jenis Pizza: ";cin>>in;
cout<<endl;
for(i=0;i<in;i++){
cout<<"Pizza ke - : "<<(i+1)<<endl;
cout<<"Kode Pizza [BR/CC/MC] : ";cin>>kode[i];
    if(strcmp(kode[i],"BR")==0){
       strcpy(jenis[i],"Beef");
      harga[i]=55000;
   }else
   if(strcmp(kode[i],"CC")==0){
       strcpy(jenis[i],"Chicken");
      harga[i]=60000;
   }else
   if(strcmp(kode[i],"MC")==0){
       strcpy(jenis[i],"Mushroom");
      harga[i]=45000;
   }else{
       strcpy(jenis[i]," - ");
      harga[i]=0;
   }
cout<<"Jenis Pizza    : "<<jenis[i]<<endl;
cout<<"Harga    : "<<harga[i]<<endl;
cout<<"Jumlah Pesan    : ";cin>>jml_pesan[i];
cout<<endl;
}
clrscr();
garis();
cout<<"\t\tBukti Pemesanan PIzza "<<endl;
cout<<"\t\tDelivery Pizza LaPizza "<<endl;
garis();
cout<<endl;
cout<<"No Pesan : "<<no<<endl;
cout<<"Nama Pemesan : "<<nama<<endl;
cout<<"====================================================\n";
cout<<"No    Jenis        Harga    Jumlah    Subtotal   "<<endl;
cout<<"      Pizza        Pizza    Pesan                "<<endl;
cout<<"====================================================\n";
for(i=0;i<in;i++){
subtotal[i]=harga[i]*jml_pesan[i];
cout<<(i+1)<<"\t"<<jenis[i]<<"\t\t"<<harga[i]<<"\t"<<jml_pesan[i]<<"\t"<<subtotal[i];
ttl_bayar=ttl_bayar+subtotal[i];
cout<<endl;
}
cout<<"====================================================\n";
printf("\t\t\tTotal Bayar :%0.2f",ttl_bayar);
cout<<"\n\t\t\tUang Bayar : ";cin>>bayar;
kembali=bayar-ttl_bayar;
printf("\t\t\tUang Kembali :%0.2f",kembali);
cout<<endl;
cout<<"======================================================\n";
cout<<"Input Lagi [Y/T] : ";cin>>lagi;
    if(lagi == 'Y' || lagi == 'y'){
   goto awal;
   }else{
   goto akhir;
   }

getch();
akhir:
}

No comments:

Post a Comment

Cerita Kita

ini cerita tentang kita, ya aku dan kamu sama-sama tau dulu kita memang sama-sama anak kampung, tapi kita bisa membuktikan kalau kita mema...