PLN

PLN

Minggu, 07 April 2013

Hitung Restaurant c++ STT-PLN

#include<iostream.h>
#include<conio.h>
void main()
{

int pil,b,a,x;
unsigned long  hrg,hg,hg1,hg2,hgm,pjk,ttl;
char p;

cout<<"        +=====================================+"<<endl;
cout<<"        |  *Program perhitungan Restaurant*   |"<<endl;
cout<<"        +=====================================+"<<endl;
pesan:
cout<<"\n\n       Daftar Menu : "<<endl;
cout<<"+------------------------------+---------------+" <<endl;
cout<<"|        Makanan               |  Harga        |" <<endl;
cout<<"+------------------------------+---------------+" <<endl;
cout<<"+ 1. Sop Iga Sapi              +"<<"  Rp 18000     +"<<endl;
cout<<"+ 2. Gurame Bakar              +"<<"  Rp 35000     +"<<endl;
cout<<"+ 3. Ayam Penyet Bumbu Kacang  +"<<"  Rp 23000     +"<<endl;
cout<<"+ 4. Kalkun Bakar              +"<<"  Rp 37000     +"<<endl;
cout<<"+==============================+===============+"<<endl<<endl;
cout<<"Makanan yang anda pesan : ";cin>>pil;
cout<<"Makanan yang anda pesan: ";
hgm=0;
switch(pil)
 { case 1: hg=18000;
    cout<<"Sop Iga Sapi  "<<endl;
    cout<<"Mau pesan berapa? : ";cin>>b;
     hg=hg*b;//pemberian Harga
     cout<<"\n---------------------------------------------------"<<endl;
                break;
case 2: hg=35000;
    cout<<"Gurame Bakar "<<endl;
    cout<<"Mau pesan berapa? : ";cin>>b;
     hg=hg*b;//pemberian Harga
     cout<<"\n---------------------------------------------------"<<endl;
            break;
    case 3: hg=23000;
    cout<<"Ayam Penyet Bumbu Kacang "<<endl;
    cout<<"Mau pesan berapa? : ";cin>>b;
    hg=hg*b;//pemberian Harga
     cout<<"\n---------------------------------------------------"<<endl;

    break;
    case 4: hg=37000;
    cout<<"Kalkun Bakar "<<endl;
    cout<<"Mau pesan berapa? : ";cin>>b;
     hg=hg*b;//pemberian Harga
     cout<<"\n---------------------------------------------------"<<endl;

     break;
    default:
    cout<<"\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bMaaf pilihan anda tidak terdaftar ";

cout<<"Mau memesan lagi? (y/t)";cin>>p;
    clrscr();
    if (p=='y'||p=='Y')
    goto pesan;
    else goto trims;}

        cout<<"\n\nMau memesan Minuman? (y/t)";cin>>p;
        clrscr();
        if (p=='y'||p=='Y')
        goto minum;
        else clrscr();  goto tidak;
minum:
cout<<"        +=====================================+"<<endl;
cout<<"        |  *Program Perhitungan Restaurant*   |"<<endl;
cout<<"        +=====================================+"<<endl;
cout<<"\n\n       Daftar Menu : "<<endl;
cout<<"+------------------------------+---------------+" <<endl;
cout<<"+        Minuman               +  Harga        +" <<endl;
cout<<"+------------------------------+---------------+" <<endl;
cout<<"+ 1. Lemon tea                 +"<<"  Rp 10000     +"<<endl;
cout<<"+ 2. Jus Avocado               +"<<"  Rp 15000     +"<<endl;
cout<<"+ 3. Sup Buah                  +"<<"  Rp 13000     +"<<endl;
cout<<"+ 4. Jus Buah                +"<<"  Rp 17000     +"<<endl;
cout<<"+==============================+===============+"<<endl<<endl;
cout<<"Minuman yang anda pesan : ";cin>>pil;
cout<<"Minuman yang anda pesan: ";

switch(pil)
 { case 1: hgm=10000;
    cout<<"Lemon Tea  "<<endl;
    cout<<"Mau pesan berapa? : ";cin>>b;
     hgm=hgm*b;//pemberian Harga
     cout<<"\n---------------------------------------------------"<<endl;
                break;
case 2: hgm=15000;
    cout<<"Jus Avocado "<<endl;
    cout<<"Mau pesan berapa? : ";cin>>b;
     hgm=hgm*b;//pemberian Harga
     cout<<"\n---------------------------------------------------"<<endl;
            break;
    case 3: hgm=13000;
    cout<<"Sup Buah "<<endl;
    cout<<"Mau pesan berapa? : ";cin>>b;
    hgm=hgm*b;//pemberian Harga
     cout<<"\n---------------------------------------------------"<<endl;

    break;
    case 4: hgm=17000;
    cout<<"Jus Daging "<<endl;
    cout<<"Mau pesan berapa? : ";cin>>b;
     hgm=hgm*b;//pemberian Harga
     cout<<"\n---------------------------------------------------"<<endl;

     break;
    default:
    cout<<"\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bMaaf pilihan anda tidak terdaftar ";

cout<<"Mau memesan lagi? (y/t)";cin>>p;
    clrscr();
    if (p=='y'||p=='Y')
    goto minum;
    else goto tidak;
            }


tidak: clrscr();

cout<<endl;
for (a=1;a<=20;a++) cout<<" -=-";
hrg=hg+hgm;
if (50000<=hrg&&hrg<100000)
            {hg1=hrg*35/100;hg2=hrg-hg1; pjk=hrg/10; ttl=hg2+pjk;
            cout<<"\n     - Harga Makanan     :Rp "<<hg<<endl;
            cout<<"     - Harga Minuman     :Rp "<<hgm<<endl;
            {for(x=1;x<=5;x++) cout<<" ";{for (a=1;a<=35;a++)cout<<"-";}}
            cout<<endl;
            cout<<"     - Total Harga       :Rp "<<hrg<<endl<<endl;
            cout<<"     - Discount 35%      :Rp "<<hg1<<endl;
            cout<<"     - Pajak 10%         :Rp "<<pjk<<endl;
            {for(x=1;x<=5;x++) cout<<" ";{for (a=1;a<=35;a++)cout<<"-";}}
            cout<<"\n     - Tagihan Anda     :Rp "<<ttl<<endl;
            }
            else if (hrg>=100000)
            {hg1=hrg*45/100;hg2=hrg-hg1; pjk=hrg/10; ttl=hg2+pjk;
            cout<<"\n     -Harga Makanan      :Rp "<<hg<<endl;
            cout<<"     -Harga Minuman      :Rp "<<hgm<<endl;
            {for(x=1;x<=5;x++) cout<<" ";{for (a=1;a<=35;a++)cout<<"-";}}
            cout<<endl;
            cout<<"     -Total Harga        :Rp "<<hrg<<endl<<endl;
            cout<<"     -Discount 45%       :Rp "<<hg1<<endl;
            cout<<"     -Pajak 10%          :Rp "<<pjk<<endl;
            {for(x=1;x<=5;x++) cout<<" ";{for (a=1;a<=35;a++)cout<<"-";}}
            cout<<"\n     -Tagihan Anda       :Rp "<<ttl<<endl;
            }
            else if(0<hrg&&hrg<50000)
            {pjk=hrg/10;ttl=hrg+pjk;
            cout<<endl<<endl;
            cout<<"     -Harga Makanan    :Rp "<<hg<<endl;
            cout<<"     -Harga Minuman    :Rp "<<hgm<<endl;
            {for(x=1;x<=5;x++) cout<<" ";{for (a=1;a<=28;a++)cout<<"-";}}
            cout<<endl;
            cout<<"     -Total Harga      :Rp "<<hrg<<endl<<endl;
            cout<<"     -Pajak 10%        :Rp "<<pjk<<endl;
            {for(x=1;x<=5;x++) cout<<" ";{for (a=1;a<=28;a++)cout<<"-";}}
            cout<<endl;
            cout<<"     -Tagihan Anda     :Rp "<<ttl<<endl;}


cout<<endl;
for (a=1;a<=20;a++) cout<<" -=-";
cout<<"\n\nMau memesan lagi? (y/t)";cin>>p;
    clrscr();
    if (p=='y'||p=='Y')
    goto pesan;
    else goto trims;
    trims:

cout<<"\n\n                  * MAMPIRLAH KEMBALI KE RESTAURANT KAMI *"<<endl;
cout<<"\n\n                      Silahkan Tunggu pesanan anda"<<endl;
        cout<<"\n                          -----Terimakasih-----";

        }

Tidak ada komentar:

Poskan Komentar