Blogger templates

Pages

Selasa, 29 Oktober 2013

"@"Program Sederhana Billing Hotel( Menggunakan Switch – Case ).

  1. Program Sederhana Billing Hotel  ( Menggunakan Switch – Case )Source Code :#include<iostream.h>
    #include<conio.h>
    #include<stdio.h>
    main()
    {
    char nm_tamu[20], kodekmr, ktgr[8], namakmr[8], ulang;
    int kodekls, lamainap;long beasewa, harga, harga_kelas, totbea;awal:
    clrscr();
    //awal:
    cout<<”==================================================”<<endl;
    cout<<”\tHOTEL BINA SARANA INFORMATIKA \n”;
    cout<<”==================================================”<<endl;
    cout<<” Nama Penginap : “; cin>> nm_tamu; cout <<endl;
    cout<<”Pilihan Kamar :\n”;
    cout<<”A-MAWAR \n”;
    cout<<”B-MELATI \n”;
    cout<<”C-ANGGREK \n”;
    cout<<” Kode Kamar : “; cin>> kodekmr;cout <<endl;
    cout<<” Input Pilihan Kelas [1.VIP/2.REGULAR]: “; cin>> kodekls;cout <<endl;
    cout<<” Lama Menginap : “; cin>>lamainap ;cout<<endl;
    cout<<” *************************************************\n”;
    switch (kodekmr)
    {
    case ‘A’:
    {
    strcpy(namakmr,”MAWAR”);
    harga=250000;
    {
    switch (kodekls)
    {
    case 1:   {
    strcpy(ktgr,”VIP”);
    harga_kelas=50000;
    }break;
    case 2: {
    strcpy(ktgr,”REGULAR”);
    harga_kelas=0;
    }default:;
    }
    }
    }break;
    case ‘B’:
    {
    strcpy(namakmr,”MELATI”);
    harga=200000;
    {
    switch (kodekls)
    {
    case 1: {
    strcpy(ktgr,”VIP”);
    harga_kelas=50000;
    }break;
    case 2: {
    strcpy(ktgr,”REGULAR”);
    harga_kelas=0;
    }default:;
    }
    }
    }break;
    case ‘C’:
    {
    strcpy(namakmr,”ANGGREK”);
    harga=150000;
    {
    switch (kodekls)
    {
    case 1: {
    strcpy(ktgr,”VIP”);
    harga_kelas=50000;
    }break;
    case 2: {
    strcpy(ktgr,”REGULAR”);
    harga_kelas=0;
    }default:;
    }
    }
    }default:;
    }
    totbea=harga*lamainap+harga_kelas;
    cout<< endl;
    clrscr();
    cout<<”\tHOTEL BINA SARANA INFORMATIKA \n”;
    cout<<”===================================================”<<endl;
    cout<<”Nama Penginap  : ” ;cout<< nm_tamu; cout <<endl;
    cout<<”Nama Kamar     : ” ;cout<< namakmr;  cout <<endl;
    cout<<”Jenis Kelas    : ” ;cout<< ktgr;     cout <<endl;
    cout<<”Harga Kamar    : “<<harga<<endl;
    cout<<”Biaya Tambahan : “<<harga_kelas<<endl;
    cout<<”Lama Menginap  : “; cout<< lamainap; cout <<” hari “; cout<<endl;
    cout<<”Total Biaya    : Rp.” <<totbea;cout <<endl;
    cout<<”***************************************************\n”<<endl;
    cout<< “                   Terima Kasih\n”;
    cout<< ” \n”;
    cout<< “                   Disusun Oleh : \n”;
    cout<< “                  Nama : Dian Permadi W\n”;
    cout<< “                  NIM  : 13130002\n”;
    printf(“\n\n”);
    cout<<”\t INGIN INPUT LAGI [Y/T]  : “; cin>>ulang;
    if (ulang == ‘y’ || ulang == ‘Y’)
    goto awal;
    getch();
    }
    Running :
    INPUT AWALINPUT
    HASIL OUTPUTOUTPUT

Tidak ada komentar:

Posting Komentar