Wednesday 16 March 2016

Scrip Program Kasir Dev C++

assalamualaikum.
kesempatan ini saya membagikan kepada teman - teman scrip program kasir dev c++.

cara menggunakannya.
1. buka program dev c++ kalian.
2. buat project baru.
3. kemudian copast scrip di bawah ini.

//fileheader
#include<iostream>
#include<stdlib.h>
#include<conio.h>
int menu(void);
int logout(void);

int menu_makanan(void);
int menu_minuman(void);
int menu_bayar(void);

using namespace std;

int main()
{
    //typedata1
    int a = 3;
    //typedata2
    string username;
    char hd;
    do
   
    {
    string passwd ="";   
       
     system ("color 9f");
   
     cout<<endl<<endl;   
     cout<<"                =================================================="<<endl;
     cout<<endl;
     cout<<"                                      HARRY KFC                   "<<endl;
     cout<<endl;
     cout<<"                =================================================="<<endl<<endl;

           cout<<"                                   SILAHKAN LOGIN           "<<endl<<endl;
       
           cout<<"                                      USERNAME              "<<endl;
           cout<<"                                        ";  cin>>username;
           cout<<endl;
           cout<<"                                      PASSWORD              "<<endl;
         
          //scrip pass hilang
           cout<<"                                        ";  hd = _getch();
           while(hd != 13) //characternya 13
           {
               passwd.push_back(hd);
               cout<< '*';
               hd = _getch();
           }
       
        if(username=="harry"&&passwd=="devi")
        {
            a=0;
            menu();
        }
        else if(username=="devi")
        {
            a--;
            system("cls");
            cout<<"\n\n";
            cout<<"password yang anda masukan salah \a"<<endl;
            cout<<"================================"<<endl<<endl;
            system("pause");
            system("cls");
            if(a==0)
            {
                cout<<endl;
                cout<<"anda telah memasukan username dan password sebanyak tiga kali , silahkan coba beberapa saat lagi"<<endl<<endl;
            }
        }
        else if(passwd=="devi")
        {
            a--;
            system("cls");
            cout<<"\n\n";
            cout<<"username yang anda masukan salah \a"<<endl;
            cout<<"================================"<<endl<<endl;
            system("pause");
            system("cls");
            if(a==0)
            {
                cout<<endl;
                cout<<"anda telah memasukan username dan password sebanyak tiga kali , silahkan coba beberapa saat lagi"<<endl<<endl;
            }
        }
        else
        {
            a--;
            system("cls");
            cout<<"\n\n";
            cout<<"username dan password yang anda masukan salah \a"<<endl;
            cout<<"============================================="<<endl<<endl;
            system("pause");
            system("cls");
            if(a==0)
            {
                cout<<endl;
                cout<<"anda telah memasukan username dan password sebanyak tiga kali , silahkan coba beberapa saat lagi"<<endl<<endl;
            }
        }
    }while(a);
    system("pause");

}

//scrip intinya
double bayar, kembali, harga = 0, total;
char pilih, makanan, minuman;

int menu()
{
    system("color 4f");
    system("cls");
    cout<<endl<<endl;
    cout<<"              ==================================================="<<endl<<endl;
    cout<<"                                  HARRY KFC                      "<<endl<<endl;
    cout<<"              ==================================================="<<endl<<endl;
    cout<<"                      >> SELAMAT DATANG DI HARRY KFC <<          "<<endl<<endl;
    cout<<"                             >> MENU PILIHAN <<                  "<<endl;
    cout<<"                           ======================                "<<endl<<endl;
    cout<<"                              1. MENU MAKANAN                    "<<endl<<endl;
    cout<<"                              2. MENU MINUMAN                    "<<endl<<endl;
    cout<<"                              3. BAYAR                           "<<endl<<endl;
    cout<<"                              4. KELUAR                          "<<endl<<endl;
    cout<<"                      >> SILAHKAN MASUKAN PILIHAN ANDA : ";
    cin>>pilih;
    switch(pilih)
    {
        case '1' :
            menu_makanan();
            break;
        case '2' :
            menu_minuman();
            break;
        case '3' :
            menu_bayar();
            break;
        case '4' :
            if(harga > 0)
            {
                cout<<endl<<endl;
                cout<<" Anda Tidak Boleh Keluar Aplikasi Karena Belum Membayar ";
                cout<<endl<<endl;
                getche();
                menu();
            }
            else
            {
                cout<<endl;
                cout<<"Terima Kasih Telah Berkunjung di HARRY KFC ^_^"<<endl<<endl;
                system("pause");
            }
            break;
        default :
            cout<<endl;
            cout<<"Pilihan yang anda masukan tidak tersedia, silahkan pilih kembali";
            getche();
            cout<<endl<<endl;
            menu();
            break;
    }
}
int menu_makanan()
{
    system ("color 5b");
    system ("cls");
    cout<<endl<<endl;
    cout<<"                       ======================     =================  "<<endl<<endl;
    cout<<"                        >>  MENU MAKANAN  <<       >>   HARGA   <<        "<<endl<<endl;
    cout<<"                       ======================     =================  "<<endl<<endl;
    cout<<"                       1. KFC KOMBO                  Rp 70.000"<<endl<<endl;
    cout<<"                       2. KFC SUPER BESAR 1          Rp 40.000"<<endl<<endl;
    cout<<"                       3. KFC SUPER BESAR 2          Rp 50.000"<<endl<<endl;
    cout<<"                       4. KFC PRAKTIS                Rp 20.000"<<endl<<endl;
    cout<<"                       5. KFC GOCENG                 Rp 5000  "<<endl<<endl;
    cout<<"                       6. KFC ALA CARTE              Rp 35.000"<<endl<<endl;
    cout<<"                       7. KFC WHOLE CHICKEN          Rp 45.000"<<endl<<endl;
    cout<<"                       8. KFC WING BUCKET            Rp 55.000"<<endl<<endl;
    cout<<"                       9. Kembali"<<endl<<endl;
    cout<<"                          Silahkan Pilih Menu Makanan Anda : ";
    cin>>makanan;
    cout<<endl;
    cout<<"                     ============================================= "<<endl;
    if(makanan == '1')
    {
        system("color c");
        cout<<endl;
        cout<<"                      KFC KOMBO : HARGA = Rp 70.000 (y/n) : ";
        cin>>pilih;
        cout<<"                     ======================================="<<endl;
        if(pilih == 'y' || pilih == 'Y')
        {
            harga += 70000;
            cout<<endl;
            cout<<"                   terima kasih telah memesan menu kami "<<endl;
            cout<<"                   press any key to continue...";
            getche();
            cout<<endl;
            menu();
        }
        else if(pilih == 'n' || pilih == 'N')
        {
            getche();
            cout<<endl<<endl;
            menu_makanan();
        }
    }
    else if(makanan == '2')
    {
        system ("color d");
        cout<<endl;
        cout<<"                      KFC SUPER BESAR 1 : HARGA = Rp 40.000 (y/n) : ";
        cin>>pilih;
        cout<<"                     =============================================="<<endl;
        if(pilih == 'y' || pilih == 'Y')
        {
            harga += 40000;
            cout<<endl;
            cout<<"                       terima kasih telah memesan menu kami "<<endl;
            cout<<"                       press any key to continue...";
            getche();
            cout<<endl;
            menu();
        }
        else if(pilih == 'n' || pilih == 'N')
        {
            getche();
            cout<<endl<<endl;
            menu_makanan();
        }
    }
    else if(makanan == '3')
    {
        system("color e");
        cout<<endl;
        cout<<"                      KFC SUPER BESAR 2 : HARGA = Rp 50.000 (y/n) : ";
        cin>>pilih;
        cout<<"                     =============================================="<<endl;
        if(pilih == 'y' || pilih == 'Y')
        {
            harga += 50000;
            cout<<endl;
            cout<<"                      terima kasih telah memesan menu kami "<<endl;
            cout<<"                      press any key to continue...";
            getche();
            cout<<endl;
            menu();
        }
        else if(pilih == 'n' || pilih == 'N')
        {
            getche();
            cout<<endl<<endl;
            menu_makanan();
        }       
    }
    else if(makanan == '4')
    {
        system("color f");
        cout<<endl;
        cout<<"                      KFC PRAKTIS : HARGA = Rp 20.000 (y/n) : ";
        cin>>pilih;
        cout<<"                     ========================================"<<endl;
        if(pilih == 'y' || pilih == 'Y')
        {
            harga += 20000;
            cout<<endl;
            cout<<"                   terima kasih telah memesan menu kami "<<endl;
            cout<<"                   press any key to continue...";
            getche();
            cout<<endl;
            menu();
        }
        else if(pilih == 'n' || pilih == 'N')
        {
            getche();
            cout<<endl<<endl;
            menu_makanan();
        }       
    }
    else if(makanan == '5')
    {
        cout<<endl;
        cout<<"                       KFC GOCENG : HARGA = Rp 5000 (y/n) : ";
        cin>>pilih;
        cout<<"                     ======================================="<<endl;
        if(pilih == 'y' || pilih == 'Y')
        {
            harga += 5000;
            cout<<endl;
            cout<<"                   terima kasih telah memesan menu kami "<<endl;
            cout<<"                   press any key to continue...";
            getche();
            cout<<endl;
            menu();
        }
        else if(pilih == 'n' || pilih == 'N')
        {
            getche();
            cout<<endl<<endl;
            menu_makanan();
        }       
    }
    else if(makanan == '6')
    {
        cout<<endl; 
        cout<<"                      KFC ALA CARTE : HARGA = Rp 35.000 (y/n) : ";
        cin>>pilih;
        cout<<"                     ========================================="<<endl;
        if(pilih == 'y' || pilih == 'Y')
        {
            harga += 35000;
            cout<<endl;
            cout<<"                    terima kasih telah memesan menu kami "<<endl;
            cout<<"                    press any key to continue...";
            getche();
            cout<<endl;
            menu();
        }
        else if(pilih == 'n' || pilih == 'N')
        {
            getche();
            cout<<endl<<endl;
            menu_makanan();
        }       
    }
    else if(makanan == '7')
    {
        cout<<endl;
        cout<<"                      KFC WHOLE CHICKEN  : HARGA = Rp 45.000 (y/n) : ";
        cin>>pilih;
        cout<<"                     ==============================================="<<endl;
        if(pilih == 'y' || pilih == 'Y')
        {
            harga += 45000;
            cout<<endl;
            cout<<"                      terima kasih telah memesan menu kami "<<endl;
            cout<<"                      press any key to continue...";
            getche();
            cout<<endl;
            menu();
        }
        else if(pilih == 'n' || pilih == 'N')
        {
            getche();
            cout<<endl<<endl;
            menu_makanan();
        }       
    }
    else if(makanan == '8')
    {
        cout<<endl;
        cout<<"                       KFC WING BUCKET : HARGA = Rp 55.000 (y/n) : ";
        cin>>pilih;
        cout<<"                     ============================================="<<endl;
        if(pilih == 'y' || pilih == 'Y')
        {
            harga += 55000;
            cout<<endl;
            cout<<"                     terima kasih telah memesan menu kami "<<endl;
            cout<<"                     press any key to continue...";
            getche();
            cout<<endl;
            menu();
        }
        else if(pilih == 'n' || pilih == 'N')
        {
            getche();
            cout<<endl<<endl;
            menu_makanan();
        }       
    }
    else if(makanan == '9')
    {
        getche();
        cout<<endl;
        menu();
    }
    else
    {
        cout<<endl;
        cout<<"                         Pilhan yang anda masukan tidak tersedia, silahkan pilih kembali";
        getche();
        cout<<endl<<endl;
        menu_makanan();
    }
}
int menu_minuman()
{
    system ("color 3a");
    system ("cls");
    cout<<endl;
    cout<<"                     ==================      ===========   "<<endl<<endl;
    cout<<"                    >>  MENU MINUMAN  <<    >>  HARGA  <<  "<<endl<<endl;
    cout<<"                     ==================      ===========   "<<endl<<endl;
    cout<<"                     1. COCACOLA             Rp 6.000"<<endl<<endl;
    cout<<"                     2. PEPSI                Rp 5.000"<<endl<<endl;
    cout<<"                     3. TEH BOTOL SOSRO      Rp 7.000"<<endl<<endl;
    cout<<"                     4. TEBS                 Rp 7.000"<<endl<<endl;
    cout<<"                     5. ES JERUK             Rp 8.000"<<endl<<endl;
    cout<<"                     6. Kembali"<<endl<<endl;
    cout<<"                        Silahkan pilih menu makanan : ";
    cin>>minuman;
    if(minuman == '1')
    {
        cout<<endl;
        cout<<"                      COCACOLA : HARGA = Rp 6.000 (y/n) : ";
        cin>>pilih;
        if(pilih == 'y' || pilih == 'Y')
        {
            harga += 6000;
            cout<<endl;
            cout<<"                 terima kasih telah memesan menu kami "<<endl;
            cout<<"                 press any key to continue...";
            getche();
            cout<<endl;
            menu();
        }
        else if(pilih == 'n' || pilih == 'N')
        {
            getche();
            cout<<endl<<endl;
            menu_minuman();
        }
    }
    else if(minuman == '2')
    {
        cout<<endl;
        cout<<"                      PEPSI : HARGA = Rp 5.000 (y/n) : ";
        cin>>pilih;
        if(pilih == 'y' || pilih == 'Y')
        {
            harga += 5000;
            cout<<endl;
            cout<<"                terima kasih telah memesan menu kami "<<endl;
            cout<<"                press any key to continue...";
            getche();
            cout<<endl;
            menu();
        }
        else if(pilih == 'n' || pilih == 'N')
        {
            getche();
            cout<<endl<<endl;
            menu_minuman();
        }
    }
    else if(minuman == '3')
    {
        cout<<endl;
        cout<<"                      TEH BOTOL SOSRO : HARGA = Rp 7.000 (y/n) : ";
        cin>>pilih;
        if(pilih == 'y' || pilih == 'Y')
        {
            harga += 7000;
            cout<<endl;
            cout<<"                     terima kasih telah memesan menu kami "<<endl;
            cout<<"                     press any key to continue...";
            getche();
            cout<<endl;
            menu();
        }
        else if(pilih == 'n' || pilih == 'N')
        {
            getche();
            cout<<endl<<endl;
            menu_minuman();
        }       
    }
    else if(minuman == '4')
    {
        cout<<endl;
        cout<<"                      TEBS : HARGA = Rp 7.000 (y/n) : ";
        cin>>pilih;
        if(pilih == 'y' || pilih == 'Y')
        {
            harga += 7000;
            cout<<endl;
            cout<<"               terima kasih telah memesan menu kami "<<endl;
            cout<<"               press any key to continue...";
            getche();
            cout<<endl;
            menu();
        }
        else if(pilih == 'n' || pilih == 'N')
        {
            getche();
            cout<<endl<<endl;
            menu_minuman();
        }       
    }
    else if(minuman == '5')
    {
        cout<<endl;
        cout<<"                      ES JERUK : HARGA = Rp 8.000 (y/n) : ";
        cin>>pilih;
        if(pilih == 'y' || pilih == 'Y')
        {
            harga += 8000;
            cout<<endl;
            cout<<"                 terima kasih telah memesan menu kami "<<endl;
            cout<<"                 press any key to continue...";
            getche();
            cout<<endl;
            menu();
        }
        else if(pilih == 'n' || pilih == 'N')
        {
            getche();
            cout<<endl<<endl;
            menu_minuman();
        }       
    }
    else if(minuman == '6')
    {
        getche();
        cout<<endl;
        menu();
    }
    else
    {
        cout<<endl;
        cout<<"               Pilhan yang anda masukan tidak tersedia, silahkan pilih kembali";
        getche();
        cout<<endl<<endl;
        menu_minuman();
    }       
}
char keluar;
int menu_bayar()
{
    if(harga == 0)
    {
        cout<<endl<<endl;
        cout<<"                Anda Belum Memesan Item Menu , silahkan pilih di daftar menu";
        getche();
        cout<<endl<<endl;
        menu();
    }
    else if(harga > 0)
    {
        NOTA :
        system("cls");
        cout<<endl<<endl;
        cout<<"                            =================================="<<endl<<endl;
        cout<<"                                   NOTA BAYAR HARRY KFC"       <<endl<<endl;
        cout<<"                            =================================="<<endl<<endl;
       
        total = harga;
        cout<<"                            >> TOTAL   = Rp "<<total<<endl<<endl;
        cout<<"                            >> BAYAR   = Rp ";
        cin>>bayar;
        if(bayar < total)
        {
            cout<<"                             Uang Anda Tidak Cukup !!"<<endl<<endl;
            getche();
            goto NOTA;
        }
        kembali = bayar - total;
        cout<<endl;
        cout<<"                            >> KEMBALI = Rp "<<kembali<<endl<<endl;   
        cout<<"                            >> TERIMA KASIH TELAH MEMESAN MENU KAMI";
        harga = 0;
        getche();
        cout<<endl<<endl;
        cout<<"                            >> KELUAR APLIKASI (y/n) ?";
        cin>>keluar;
        cout<<endl;
        cout<<"                               www.creart.himatik.com"<<endl;
        if(keluar == 'n' || keluar == 'N')
        {
            menu();
        }
        system("exit");
    }
}


 4. save as programnya, kemudian tekan f9 untuk memeriksa dan f10 untuk menjalankan programnya.

terimakasih sudah membaca artikel saya.
jangan lupa share n join blog saya.

  

0 komentar:

Post a Comment