Program Kasir C++


Program Kasir C++







#include <iostream>
#include <conio.h>
#include <iomanip>
#include <windows.h>
#include <stdlib.h>

using namespace std;

void garis();
int main()
{
    int nofaktur, kodeb[99][99], kode_b, kode_b1, kode_b2, kode_b3, kode_b4, kode_b5,jumbel, jumlah_b, jumlah_b1, jumlah_b2, jumlah_b3, jumlah_b4, jumlah_b5, no, no1, no2, no3, no4, s, j_bayar, j_bayar1, j_bayar2, j_bayar3, j_bayar4, bayar, harga, harga1, harga2, harga3, harga4;
    float ppn, discount, kembalian, total, j_total;
    char nama_b[99], nama_b1[99], nama_b2[99], nama_b3[99], nama_b4[99], nama_b5[99];

    SetConsoleTextAttribute (GetStdHandle(STD_OUTPUT_HANDLE),500);

    kodeb[0][0]=1500;
    kodeb[0][1]=3000;
    kodeb[0][2]=4500;
    kodeb[1][0]=6000;
    kodeb[1][1]=7500;
    kodeb[1][2]=9000;
    kodeb[2][0]=10500;
    kodeb[2][1]=12000;
    kodeb[2][2]=13500;

    system("color 1F");
    cout<<"\t===========Putri Dewi Wulandari_1610631170166_2E============";
    cout<<"\t=================Suhairoh_1610631170211_2E==================";
    cout<<endl;

    garis();
    cout<<"\t------------TOSERBA HALAL-------------------------------------";
    garis();
    cout<<"No. Faktur     : ";
    cin>>nofaktur;
    cout<<"Jumlah beli    : ";
    cin>>jumbel;
    garis();
    garis();

    s=jumbel;

     system("color 3F");
    if(s>0)
    {
            cout<<" Kode barang    : ";
            cin>>kode_b;
            cout<<" Nama  barang   : ";
            cin>>nama_b;
            cout<<" Jumlah beli  : ";
            cin>>jumlah_b;
            s--;
            if(s>0)
            {
            cout<<"\n Masukkan Nama  barang   : ";cin>>nama_b1;
            cout<<" Masukkan Kode barang    : ";cin>>kode_b1;
            cout<<" Masukkan Jumlah barang  : ";cin>>jumlah_b1;
             s--;
                if(s>0)
                {
                     cout<<" Kode barang    : ";
                     cin>>nama_b2;
                     cout<<" Nama  barang   : ";
                     cin>>kode_b2;
                     cout<<" Jumlah beli  : ";
                     cin>>jumlah_b2;
                     s--;
                    if(s>0)
                    {
                       cout<<" Kode barang    : ";
                       cin>>nama_b3;
                       cout<<" Nama  barang   : ";
                       cin>>kode_b3;
                       cout<<" Jumlah beli  : ";
                       cin>>jumlah_b3;
                        s--;
                        if(s>0)
                        {
                            cout<<" Kode barang    : ";
                            cin>>nama_b4;
                            cout<<" Nama  barang   : ";
                            cin>>kode_b4;
                            cout<<" Jumlah beli  : ";
                            cin>>jumlah_b4;
                            s--;
                            if(s>0)
                            {
                                cout<<" Kode barang    : ";
                                cin>>nama_b5;
                                cout<<" Nama  barang   : ";
                                cin>>kode_b5;
                                cout<<" Jumlah beli  : ";
                                cin>>jumlah_b5;
                                s--;
                            }
                        }
                    }

                }
            }
    }

     if(kode_b<=10){harga=kodeb[0][0];}else if(kode_b<=20){harga=kodeb[0][1];}else if(kode_b<=30){harga=kodeb[0][2];}
     if(kode_b1<=10){harga1=kodeb[0][0];}else if(kode_b1<=20){harga1=kodeb[0][1];}else if(kode_b1<=30){harga1=kodeb[0][2];}
     if(kode_b2<=10){harga2=kodeb[0][0];}else if(kode_b2<=20){harga2=kodeb[0][1];}else if(kode_b2<=30){harga2=kodeb[0][2];}
     if(kode_b3<=10){harga3=kodeb[0][0];}else if(kode_b3<=20){harga3=kodeb[0][1];}else if(kode_b3<=30){harga3=kodeb[0][2];}
     if(kode_b4<=10){harga4=kodeb[0][0];}else if(kode_b4<=20){harga4=kodeb[0][1];}else if(kode_b4<=30){harga4=kodeb[0][2];}

    j_bayar=jumlah_b*harga, j_bayar1=jumlah_b1*harga1, j_bayar2=jumlah_b2*harga2, j_bayar3=jumlah_b3*harga3, j_bayar4=jumlah_b4*harga4;

    SetConsoleTextAttribute (GetStdHandle(STD_OUTPUT_HANDLE),185);

    garis();
    garis();
    system("color 5F");
    cout<<"\t\t\tBUKTI PEMBELANJAAN\n";
    cout<<"\t\t\tTOSERBA HALAL\n";
    garis();
    garis();
    garis();

    system("color 1F");
    cout<<" No. |   Kode Barang  |     Harga     | Jumlah barang |  Jumlah bayar|"<<endl;
    garis();

    no=1;
    s=jumbel;

        if(s>0)
        {

                cout<<" "<<no<<setw(4)<<"|"
                <<setw(9)<<kode_b<<setw(8)<<"|"
                <<setw(7)<<harga<<setw(9)<<"|"
                <<setw(8)<<jumlah_b<<setw(8)<<"|"
                <<setw(10)<<j_bayar<<setw(6)<<"|\n";
                s--;j_total=j_bayar;
        }
        if(s>0)
        {
            no1=2;
            cout<<" "<<no1<<setw(4)<<"|"
            <<setw(9)<<kode_b1<<setw(8)<<"|"
            <<setw(7)<<harga1<<setw(9)<<"|"
            <<setw(8)<<jumlah_b1<<setw(8)<<"|"
            <<setw(10)<<j_bayar1<<setw(6)<<"|\n";
            s--;j_total=j_bayar+j_bayar1;
        }
        if(s>0)
        {
            no2=3;
            cout<<" "<<no2<<setw(4)<<"|"
            <<setw(9)<<kode_b2<<setw(8)<<"|"
            <<setw(7)<<harga2<<setw(9)<<"|"
            <<setw(8)<<jumlah_b2<<setw(8)<<"|"
            <<setw(10)<<j_bayar2<<setw(6)<<"|\n";
            s--;j_total=j_bayar+j_bayar1+j_bayar2;
        }
        if(s>0)
        {
            no3=4;
            cout<<" "<<no3<<setw(4)<<"|"
            <<setw(9)<<kode_b3<<setw(8)<<"|"
            <<setw(7)<<harga3<<setw(9)<<"|"
            <<setw(8)<<jumlah_b3<<setw(8)<<"|"
            <<setw(10)<<j_bayar3<<setw(6)<<"|\n";
            s--;j_total=j_bayar+j_bayar1+j_bayar2+j_bayar3;
        }
        if(s>0)
        {
            no4=5;
            cout<<" "<<no4<<setw(4)<<"|"
            <<setw(9)<<kode_b4<<setw(8)<<"|"
            <<setw(7)<<harga4<<setw(9)<<"|"
            <<setw(8)<<jumlah_b4<<setw(8)<<"|"
            <<setw(10)<<j_bayar4<<setw(6)<<"|\n";
            s--;j_total=j_bayar+j_bayar1+j_bayar2+j_bayar3;+j_bayar4;
        }
    garis();


    if(j_total>=200000)
    {
        discount=j_total*0.2;
    }
    else
    {
        discount=0;
    }
    ppn=j_total*0.1;
    total=j_total-discount+ppn;
    cout<<"\n Potongan Harga: "<<discount<<endl;
    cout<<" PPn (10%)     : "<<ppn<<endl;
    cout<<" Total bayar   : "<<total<<endl<<endl;
    garis();
    cout<<" Uang bayar    : ";cin>>bayar;
    kembalian=bayar-total;
    cout<<" Uang Kembali  : "<<kembalian<<endl;
    garis();

    garis();

    SetConsoleTextAttribute (GetStdHandle(STD_OUTPUT_HANDLE),249);

    cout<<"================SYUKRON TELAH BERBELANJA DITOSERBA HALAL=============="<<endl;
    cout<<endl;
}

void garis()
{
    cout<<"----------------------------------------------------------------------";
    cout<<endl;
}







Komentar

Postingan populer dari blog ini

Animasi Roket Sederhana dengan C++

Animasi Teks Berjalan C++

Program membuat animasi sederhana