Loading...
Home » » PROGRAM MENU MAKANAN BESERTA HARGANYA DALAM DEV C++

PROGRAM MENU MAKANAN BESERTA HARGANYA DALAM DEV C++

Posted by TeknoBlog on Monday, 12 December 2016


CONTOH PROGRAM MENU MAKANAN BESERTA HARGANYA DALAM DEV C++

PROGRAMNYA :

#include <cstdlib>
#include <iostream>
// yogi.king.pratama@blogspot.com
using namespace std;
int main(int argc, char *argv[])
{
    int mm, p, bp, sp;
    double hrg;
    float diskon, pjk, th, byr;
lagi:
    cout<<"MENU MAKANAN"<<endl;
    cout<<"1. Cap Cay Goreng"<<endl;
    cout<<"2. Kakap Asam Manis"<<endl;
    cout<<"3. Puyung Hay"<<endl<<endl;
    cout<<"Pilihan ? ";cin>>mm;
   if(mm<=0 || mm>3)
    {
            cout<<"Menu tdk ada"<<endl<<endl<<endl;
            goto lagi;
    }
lagidong:
    cout<<endl<<endl;
    cout<<"P O R S I"<<endl;
    cout<<"1. Kecil"<<endl;
    cout<<"2. Sedang"<<endl;
    cout<<"3. Besar"<<endl<<endl;
    cout<<"Pilihan ? ";cin>>p;
    if(p<=0 || p>3)
    {
            cout<<"Porsi tdk ada"<<endl<<endl<<endl;
            goto lagidong;
    }
    cout<<endl<<endl;
    cout<<"Banyak Pesanan ? ";cin>>bp;
    cout<<endl<<endl;
lagidongah:
    cout<<"STATUS PESANAN"<<endl;
    cout<<"1. Makan Di Tempat"<<endl;
    cout<<"2. Bawa Pulang"<<endl<<endl;
    cout<<"Pilihan ? ";cin>>sp;
   if(sp<=0 || sp>2)
    {
            cout<<"Status pesan tdk ada"<<endl<<endl<<endl;
            goto lagidongah;
    }
    cout<<endl<<endl;
    if(mm==1)
    {
            if(p==1)
                  hrg=15000;
            else if(p==2)
                  hrg=20000;
            else
                  hrg=25000;
    }
    else if(mm==2)
    {
            if(p==1)
                  hrg=30000;
            else if(p==2)
                  hrg=40000;
            else
                  hrg=50000;
    }  
    else
    {
            if(p==1)
                  hrg=10000;
            else if(p==2)
                  hrg=15000;
            else
                  hrg=20000;
    }
    th=bp*hrg;
    if(sp==1)
         pjk=10/100. * th;
    else
         pjk=0;
    if(mm==2 && p==3)
          diskon=5./100 *th;
    else
          diskon=0;
    byr=th-diskon+pjk;
    cout<<"Total Harga = "<<th<<endl;
    cout<<"Diskon      = "<<diskon<<endl;
    cout<<"Pajak       = "<<pjk<<endl;
    cout<<"Bayar       = "<<byr<<endl;
   
    system("PAUSE");
    return EXIT_SUCCESS;
}
HASIL COMPILE :

























Sekian Dan Trimakasih

Thanks for reading & sharing TeknoBlog

Previous
« Prev Post

0 comments:

Post a Comment

iklan