Program Penjualan Kue C++






Pada kesempatan kali ini saya akan  share kode program pembuatan aplikasi penjualan kue C++, berikut listing kodenya.


#include <iostream>
using namespace std;

int main(){
int kodek, jumlahk, hargak, totalh;
char namap[30];
string namak1, namak2, namak3, namak4;

cout<<"|    DAFTAR MENU TOKO KUE 'BUANA'       |"<<endl;
cout<<"|---------------------------------------|"<<endl;
cout<<"|kode |    daftar kue     |   harga     |"<<endl;
cout<<"|---------------------------------------|"<<endl;
cout<<"| 1.  | Bolu Black Forest |  Rp. 60000  |"<<endl;
cout<<"| 2.  | Chesse Cake       |  Rp. 45000  |"<<endl;
cout<<"| 3.  | Banana Cake       |  Rp. 25500  |"<<endl;
cout<<"| 4.  | Strawbery Cake    |  Rp. 35000  |"<<endl;
cout<<"|---------------------------------------|"<<endl;
cout<<endl;
namak1="Bolu Black Forest";
namak2="Chesse Cake";
namak3="Banana Cake";
namak4="Strawbery Cake";

cout<<"Nama Pembeli      : ";cin.getline(namap,30);
cout<<"Kode Kue [1/2/3/4]: ";cin >> kodek;
cout<<"Jumlah Kue      : ";cin >> jumlahk;
cout<<endl;
cout<<"_____________________________________"<<endl;
cout<<endl;

cout<<"STRUK PEMBAYARAN TOKO KUE 'SEDAP'"<<endl;
cout<<"* * * * * * * * * * * * * * * * *"<<endl;
cout<<"Nama Pembeli    = "<<namap<<endl;
switch(kodek)
    {
    case 1 :
        cout<<"Kode Kue    = "<<kodek<<endl;
        cout<<"Nama Kue     = "<<namak1<<endl;
    break;
    case 2 :
        cout<<"Kode Kue    = "<<kodek<<endl;
        cout<<"Nama Kue     = "<<namak2<<endl;
    break;
    case 3 :
        cout<<"Kode Kue    = "<<kodek<<endl;
        cout<<"Nama Kue     = "<<namak3<<endl;
    break;
    case 4 :
        cout<<"Kode Kue    = "<<kodek<<endl;
        cout<<"Nama Kue     = "<<namak4<<endl;
    break;
    default :
        cout<<"Kode Kue    = -"<<endl;
        cout<<"Nama Kue     = Tidak Ada Dalam Menu"<<endl;
        cout<<"Harga Kue     = Rp. "<<endl;
        cout<<"Jumlah Kue     = -"<<endl;
        cout<<"Total Harga     = Rp. "<<endl;
        cout<<"* * * * * * * * * * * * * * * * *"<<endl;
        cout<<"Diskon        = Tidak Dapat"<<endl;
        cout<<"* * * * * * * * * * * * * * * * *"<<endl;
        cout<<"Total Bayar    = Rp. "<<endl;
    }
    if (kodek==1)
        {
        hargak=60000;
        totalh=jumlahk*hargak;
        cout<<"Harga Kue     = Rp. "<<hargak<<endl;
        cout<<"Jumlah Kue     = "<<jumlahk<<endl;
        cout<<"Total Harga     = Rp. "<<totalh<<endl;
        cout<<"* * * * * * * * * * * * * * * * *"<<endl;
        {if (jumlahk > 20)
            cout<<"Diskon        = Rp. "<<totalh*20/100<<endl;
            else if (jumlahk > 10)
                cout<<"Diskon        = Rp. "<<totalh*5/100<<endl;
                else cout<<"Diskon        = Tidak Dapat"<<endl;}
        cout<<"* * * * * * * * * * * * * * * * *"<<endl;
        {if (jumlahk > 20)
            cout<<"Total Bayar    = Rp. "<<totalh-(totalh*20/100)<<endl;
            else if (jumlahk > 10)
                cout<<"Total Bayar    = Rp. "<<totalh-(totalh*5/100)<<endl;
                else cout<<"Total Bayar    = Rp. "<<totalh<<endl;}
        }  
    else if (kodek==2)
        {
        hargak=45000;
        totalh=jumlahk*hargak;
        cout<<"Harga Kue     = Rp. "<<hargak<<endl;
        cout<<"Jumlah Kue     = "<<jumlahk<<endl;
        cout<<"Total Harga     = Rp. "<<totalh<<endl;
        cout<<"* * * * * * * * * * * * * * * * *"<<endl;
        {if (jumlahk > 20)
            cout<<"Diskon        = Rp. "<<totalh*20/100<<endl;
            else if (jumlahk > 10)
                cout<<"Diskon        = Rp. "<<totalh*5/100<<endl;
                else cout<<"Diskon        = Tidak Dapat"<<endl;}
        cout<<"* * * * * * * * * * * * * * * * *"<<endl;
        {if (jumlahk > 20)
            cout<<"Total Bayar    = Rp. "<<totalh-(totalh*20/100)<<endl;
            else if (jumlahk > 10)
                cout<<"Total Bayar    = Rp. "<<totalh-(totalh*5/100)<<endl;
                else cout<<"Total Bayar    = Rp. "<<totalh<<endl;}
        }
    else if (kodek==3)
        {
        hargak=25500;
        totalh=jumlahk*hargak;
        cout<<"Harga Kue     = Rp. "<<hargak<<endl;
        cout<<"Jumlah Kue     = "<<jumlahk<<endl;
        cout<<"Total Harga     = Rp. "<<totalh<<endl;
        cout<<"* * * * * * * * * * * * * * * * *"<<endl;
        {if (jumlahk > 20)
            cout<<"Diskon        = Rp. "<<totalh*20/100<<endl;
            else if (jumlahk > 10)
                cout<<"Diskon        = Rp. "<<totalh*5/100<<endl;
                else cout<<"Diskon        = Tidak Dapat"<<endl;}
        cout<<"* * * * * * * * * * * * * * * * *"<<endl;
        {if (jumlahk > 20)
            cout<<"Total Bayar    = Rp. "<<totalh-(totalh*20/100)<<endl;
            else if (jumlahk > 10)
                cout<<"Total Bayar    = Rp. "<<totalh-(totalh*5/100)<<endl;
                else cout<<"Total Bayar    = Rp. "<<totalh<<endl;}
        }
    else if (kodek==4)
        {
        hargak=35000;
        totalh=jumlahk*hargak;
        cout<<"Harga Kue     = Rp. "<<hargak<<endl;
        cout<<"Jumlah Kue     = "<<jumlahk<<endl;
        cout<<"Total Harga     = Rp. "<<totalh<<endl;
        cout<<"* * * * * * * * * * * * * * * * *"<<endl;
        {if (jumlahk > 20)
            cout<<"Diskon        = Rp. "<<totalh*20/100<<endl;
            else if (jumlahk > 10)
                cout<<"Diskon        = Rp. "<<totalh*5/100<<endl;
                else cout<<"Diskon        = Tidak Dapat"<<endl;}
        cout<<"* * * * * * * * * * * * * * * * *"<<endl;
        {if (jumlahk > 20)
            cout<<"Total Bayar    = Rp. "<<totalh-(totalh*20/100)<<endl;
            else if (jumlahk > 10)
                cout<<"Total Bayar    = Rp. "<<totalh-(totalh*5/100)<<endl;
                else cout<<"Total Bayar    = Rp. "<<totalh<<endl;}
        }
return 0;
}

Contoh Hasil Dari Program Tersebut


Posting Komentar

1 Komentar