Blogger templates

Pages

Selasa, 29 Oktober 2013

"@"Program Sederhana Toko Cake


  1. Program Sederhana Toko Cake Menggunakan ( Switch – Case )
    Source Code :

    #include<stdio.h>
    #include<iostream.h>
    #include<conio.h>main()
    {
    int harga,bayar,kembali,minus,back,jb,tb,uk;
    char jr[10],nm_cst[20],kode,ulang,uk_roti[8];awal:
    clrscr();
    //awalcout<<”\t\tTOKO CAKE SEJAHTERA \n”;
    cout<<”===================================================”<<endl;
    cout<<”Nama Customer        :”;gets(nm_cst);
    cout<<”Kode Roti [T/I/B]    :”;cin>>kode;
    cout<<”Ukuran [1/2/3]       :”;cin>>uk;switch (kode)
    {
    case ‘T’:
    {
    strcpy(jr,”Roti Tawar”);
    {
    switch (uk)
    {
    case 1:   {
    strcpy(uk_roti,”Besar”);
    harga=7000;
    }break;
    case 2: {
    strcpy(uk_roti,”Sedang”);
    harga=5000;
    }break;
    case 3: {
    strcpy(uk_roti,”Kecil”);
    harga=3000;
    }default:;
    }
    }
    }break;
    case ‘I’:
    {
    strcpy(jr,”Roti Isi”);
    {
    switch (uk)
    {
    case 1:   {
    strcpy(uk_roti,”Besar”);
    harga=10000;
    }break;
    case 2: {
    strcpy(uk_roti,”Sedang”);
    harga=8000;
    }break;
    case 3: {
    strcpy(uk_roti,”Kecil”);
    harga=6000;
    }default:;
    }
    }
    }break;
    case ‘B’:
    {
    strcpy(jr,”Roti Bakar”);
    {
    switch (uk)
    {
    case 1:   {
    strcpy(uk_roti,”Besar”);
    harga=11000;
    }break;
    case 2: {
    strcpy(uk_roti,”Sedang”);
    harga=9000;
    }break;
    case 3: {
    strcpy(uk_roti,”Kecil”);
    harga=7000;
    }default:;
    }
    }
    }default:;
    }clrscr();
    cout<<”===================================================”<<endl;
    cout<<”Nama Customer     : “<<nm_cst<<endl;
    cout<<”Kode Roti         : “<<kode<<endl;
    cout<<”Jenis Roti        : “<<jr<<endl;
    cout<<”Ukuran Roti       : “<<uk_roti<<endl;
    cout<<”Harga Satuan      : “<<harga<<endl;
    cout<<”===================================================”<<endl;
    cout<<”Input Jumlah Beli : “; cin>>jb;
    cout<<” “<<endl;
    tb=harga*jb;
    cout<<”Total Harga    : Rp. “<<tb<<endl;
    cout<<”Uang Bayar     : Rp. “;cin>>bayar;
    cout<<” “<<endl;
    kembali=bayar-tb;
    cout<<”Uang Kembali   : Rp. “<<kembali<<endl;
    cout<<”===================================================”<<endl;
    if (bayar>tb)
    {back=bayar-tb;
    cout <<”\nUang Kembali Sebesar     = Rp.”<<back;}
    else
    if (bayar<tb)
    {minus=bayar-tb;
    cout <<”\nUang Anda Tidak Cukup = Rp.”<<minus<<endl;
    cout <<”Maaf Kami tidak Melayani Hutang\n”;}
    cout <<”\n\nTerimakasih sudah berbelanja di TOKO CAKE SEJAHTERA\n”;
    cout <<”\t\tDian Permadi W  | 13130002\n”<<endl;
    cout<<”\t INGIN INPUT LAGI [Y/T]  : “; cin>>ulang;
    if (ulang == ‘y’ || ulang == ‘Y’)
    goto awal;
    getch();
    }
    Running :
    INPUT-RTINPUT DATA
    OUTPUT PLUS-RTOUTPUT DGN NILAI PLUS
    OUTPUT MINUS-RTOUTPUT DGN NILAI MINUS

Tidak ada komentar:

Posting Komentar