Minggu, 23 September 2012

program c++

Contoh program c++

#include
#include
int main ()
{
      system("cls");
      char tipe_rumah,ulang;
      int jenis_bayar;
      atas:
      cout <<"PT. Perumahan Rakyat\n";
      cout <<"--------------------\n";
      cout <
      cout <<"Tipe rumah:\n";
      cout <<"-----------\n";
     cout <<"Rumah A = tunai Rp.50jt,  angsur Rp.500rb/bulan\n";
     cout <<"Rumah B = tunai Rp.75jt,  angsur Rp.750rb/bulan\n";
      cout <<"Rumah C = tunai Rp.85jt,  angsur Rp.850rb/bulan\n";
      cout <<"Rumah D = tunai Rp.100jt, angsur Rp.1jt/bulan\n";
      cout <<"Pilih E untuk Exit/Keluar\n";
      cout <
      cout <<"Rumah Tipe pilihan anda :";cin >>tipe_rumah;
      switch (tipe_rumah)
      {
                case 'A':
                      system("cls");
                 pertama:
                      cout <<"PT. Perumahan Rakyat\n";
                 cout <<"--------------------\n";
                      cout <
                 cout <<"Jenis pembayaran :\n";
                      cout <<"------------------\n";
                 cout <<"1 = Tunai\n";
                      cout <<"2 = Angsuran\n";
                 cout <<"0 = Menu sebelumnya\n";
                      cout <<"E = Exit/Keluar\n";
                 cout <
                      cout <<"Pilihan anda <1-2> = ";cin >>jenis_bayar;
                 if (jenis_bayar==1){
                                                 system("cls");
                                     cout <<"PT. Perumahan Rakyat\n";
                                                 cout <<"--------------------\n";
                                     cout <
                                                 cout <<"-------------------------------------------------\n";
                                     cout <<"Tipe rumah yang anda pilih adalah = tipe-A\n";
                                                 cout <<"Jenis pembayaran rumah = Tunai Rp. 50.000.000\n";
                                     cout <<"-------------------------------------------------\n";
                                                 cout <
                                     cout <<"ULANG...??? =";cin >>ulang;
                                                 if (ulang=='Y'){
                                                     system("cls");
                                                   goto atas;
                                                   }else if (ulang=='T'){
                                                                            system("cls");
                                                         cout <<"-----------------\n";
                                                         cout <<"Terima Kasih ^-^.\n";
                                                         cout <<"-----------------\n";
                                                                            cout <<"Nama  : RIZKIA ASSANI\n";
                                                         cout <<"NPM   :11108724\n";
                                                         cout <<"Kelas :2KA06\n";}
                                                         else { cout <<"Input salah...!!! ULANGI."<<
                                                 }
                                     else if (jenis_bayar==2){
                                     system("cls");
                                     cout <<"PT. Perumahan Rakyat\n";
                                                 cout <<"--------------------\n";
                                     cout <
                                     cout <<"-------------------------------------------------\n";
                                     cout <<"Tipe rumah yang anda pilih adalah = tipe-A\n";
                                                 cout <<"Jenis pembayaran rumah = Angsuran Rp. 500.000/ bulan\n";
                                     cout <<"-------------------------------------------------\n";
                                     cout <
                                     cout <<"ULANG...??? =";cin >>ulang;
                                                 if (ulang=='Y'){
                                                     system("cls");
                                                   goto atas;
                                                   }else if (ulang=='T'){
                                                                            system("cls");
                                                         cout <<"-----------------\n";
                                                         cout <<"Terima Kasih ^-^.\n";
                                                         cout <<"-----------------\n";
                                                                            cout <<"Nama  : RIZKIA ASSANI\n";
                                                         cout <<"NPM   :11108724\n";
                                                         cout <<"Kelas :2KA06\n";}
                                                         else { cout <<"Input salah...!!! ULANGI."<<
                                     }
                                                 else if (jenis_bayar==0){
                                     system("cls");
                                                         goto atas;}
                                                         else if (jenis_bayar=='E'){
                                                              exit(0);}
                                                                                  else{cout <<"Pilihan Salah...!!! ULANGI.";}
                                                              break;
                                                             
            case 'B':
                 system("cls");
                      kedua:
                 cout <<"PT. Perumahan Rakyat\n";
                 cout <<"--------------------\n";
                 cout <
                 cout <<"Jenis pembayaran :\n";
                      cout <<"------------------\n";
                 cout <<"1 = Tunai\n";
                 cout <<"2 = Angsuran\n";
                 cout <<"0 = Menu sebelumnya\n";
                 cout <<"E = Exit/Keluar\n";
                      cout <
                 cout <<"Pilihan anda <1-2> = ";cin >>jenis_bayar;
                 if (jenis_bayar==1){
                                     system("cls");
                                     cout <<"PT. Perumahan Rakyat\n";
                                                 cout <<"--------------------\n";
                                     cout <
                                     cout <<"-------------------------------------------------\n";
                                     cout <<"Tipe rumah yang anda pilih adalah = tipe-A\n";
                                     cout <<"Jenis pembayaran rumah = Tunai Rp. 75.000.000\n";
                                                 cout <<"-------------------------------------------------\n";
                                     cout <
                                     cout <<"ULANG...??? =";cin >>ulang;
                                     if (ulang=='Y'){
                                                     system("cls");
                                                                    goto atas;
                                                   }else if (ulang=='T'){
                                                         system("cls");
                                                         cout <<"-----------------\n";
                                                         cout <<"Terima Kasih ^-^.\n";
                                                                            cout <<"-----------------\n";
                                                         cout <<"Nama  : RIZKIA ASSANI\n";
                                                         cout <<"NPM   :11108724\n";
                                                         cout <<"Kelas :2KA06\n";}
                                                         else { cout <<"Input salah...!!! ULANGI."<<
                                                 }
                                     else if (jenis_bayar==2){
                                     system("cls");
                                     cout <<"PT. Perumahan Rakyat\n";
                                     cout <<"--------------------\n";
                                                 cout <
                                     cout <<"-------------------------------------------------\n";
                                     cout <<"Tipe rumah yang anda pilih adalah = tipe-A\n";
                                     cout <<"Jenis pembayaran rumah = Angsuran Rp. 750.000/ bulan\n";
                                     cout <<"-------------------------------------------------\n";
                                                 cout <
                                     cout <<"ULANG...??? =";cin >>ulang;
                                     if (ulang=='Y'){
                                                     system("cls");
                                                   goto atas;
                                                                    }else if (ulang=='T'){
                                                         system("cls");
                                                         cout <<"-----------------\n";
                                                         cout <<"Terima Kasih ^-^.\n";
                                                         cout <<"-----------------\n";
                                                                            cout <<"Nama  : RIZKIA ASSANI\n";
                                                         cout <<"NPM   :111108724\n";
                                                         cout <<"Kelas :2KA06\n";}
                                                         else { cout <<"Input salah...!!! ULANGI."<<
                                     }
                                                 else if (jenis_bayar==0){
                                     system("cls");
                                                         goto atas;}
                                                         else if (jenis_bayar=='E'){
                                                              exit(0);}
                                                                                  else{cout <<"Pilihan Salah...!!! ULANGI.";}
                                                              break;
                                                             
            case 'C':
                 system("cls");
                      ketiga:
                 cout <<"PT. Perumahan Rakyat\n";
                 cout <<"--------------------\n";
                 cout <
                 cout <<"Jenis pembayaran :\n";
                      cout <<"------------------\n";
                 cout <<"1 = Tunai\n";
                 cout <<"2 = Angsuran\n";
                 cout <<"0 = Menu sebelumnya\n";
                 cout <<"E = Exit/Keluar\n";
                      cout <
                 cout <<"Pilihan anda <1-2> = ";cin >>jenis_bayar;
                 if (jenis_bayar==1){
                                     system("cls");
                                     cout <<"PT. Perumahan Rakyat\n";
                                                 cout <<"--------------------\n";
                                     cout <
                                     cout <<"-------------------------------------------------\n";
                                     cout <<"Tipe rumah yang anda pilih adalah = tipe-A\n";
                                     cout <<"Jenis pembayaran rumah = Tunai Rp. 85.000.000\n";
                                                 cout <<"-------------------------------------------------\n";
                                     cout <
                                     cout <<"ULANG...??? =";cin >>ulang;
                                     if (ulang=='Y'){
                                                     system("cls");
                                                                    goto atas;
                                                   }else if (ulang=='T'){
                                                         system("cls");
                                                         cout <<"-----------------\n";
                                                         cout <<"Terima Kasih ^-^.\n";
                                                                            cout <<"-----------------\n";
                                                         cout <<"Nama  : RIZKIA ASSANI\n";
                                                         cout <<"NPM   :11108724\n";
                                                         cout <<"Kelas :2KA06\n";}
                                                         else { cout <<"Input salah...!!! ULANGI."<<
                                                 }
                                     else if (jenis_bayar==2){
                                     system("cls");
                                     cout <<"PT. Perumahan Rakyat\n";
                                     cout <<"--------------------\n";
                                                 cout <
                                     cout <<"-------------------------------------------------\n";
                                     cout <<"Tipe rumah yang anda pilih adalah = tipe-A\n";
                                     cout <<"Jenis pembayaran rumah = Angsuran Rp. 850.000/ bulan\n";
                                     cout <<"-------------------------------------------------\n";
                                                 cout <
                                     cout <<"ULANG...??? =";cin >>ulang;
                                     if (ulang=='Y'){
                                                     system("cls");
                                                   goto atas;
                                                                    }else if (ulang=='T'){
                                                         system("cls");
                                                         cout <<"-----------------\n";
                                                         cout <<"Terima Kasih ^-^.\n";
                                                         cout <<"-----------------\n";
                                                                            cout <<"Nama  : RIZKIA ASSANI\n";
                                                         cout <<"NPM   :11108742\n";
                                                         cout <<"Kelas :2KA06\n";}
                                                         else { cout <<"Input salah...!!! ULANGI."<<
                                     }
                                                 else if (jenis_bayar==0){
                                     system("cls");
                                                         goto atas;}
                                                         else if (jenis_bayar=='E'){
                                                              exit(0);}
                                                                                  else{cout <<"Pilihan Salah...!!! ULANGI.";}
                                                              break;
                                                             
                 case 'D':
                 system("cls");
                      keempat:
                 cout <<"PT. Perumahan Rakyat\n";
                 cout <<"--------------------\n";
                 cout <
                 cout <<"Jenis pembayaran :\n";
                      cout <<"------------------\n";
                 cout <<"1 = Tunai\n";
                 cout <<"2 = Angsuran\n";
                 cout <<"0 = Menu sebelumnya\n";
                 cout <<"E = Exit/Keluar\n";
                      cout <
                 cout <<"Pilihan anda <1-2> = ";cin >>jenis_bayar;
                 if (jenis_bayar==1){
                                     system("cls");
                                     cout <<"PT. Perumahan Rakyat\n";
                                                 cout <<"--------------------\n";
                                     cout <
                                     cout <<"-------------------------------------------------\n";
                                     cout <<"Tipe rumah yang anda pilih adalah = tipe-A\n";
                                     cout <<"Jenis pembayaran rumah = Tunai Rp. 100.000.000\n";
                                                 cout <<"-------------------------------------------------\n";
                                     cout <
                                     cout <<"ULANG...??? =";cin >>ulang;
                                     if (ulang=='Y'){
                                                     system("cls");
                                                                    goto atas;
                                                   }else if (ulang=='T'){
                                                         system("cls");
                                                         cout <<"-----------------\n";
                                                         cout <<"Terima Kasih ^-^.\n";
                                                                            cout <<"-----------------\n";
                                                         cout <<"Nama  : RIZKIA ASSANI\n";
                                                         cout <<"NPM   :11108724\n";
                                                         cout <<"Kelas :2KA06\n";}
                                                         else { cout <<"Input salah...!!! ULANGI."<<
                                                 }
                                     else if (jenis_bayar==2){
                                     system("cls");
                                     cout <<"PT. Perumahan Rakyat\n";
                                     cout <<"--------------------\n";
                                                 cout <
                                     cout <<"-------------------------------------------------\n";
                                     cout <<"Tipe rumah yang anda pilih adalah = tipe-A\n";
                                     cout <<"Jenis pembayaran rumah = Angsuran Rp. 1.000.000/ bulan\n";
                                     cout <<"-------------------------------------------------\n";
                                                 cout <
                                     cout <<"ULANG...??? =";cin >>ulang;
                                     if (ulang=='Y'){
                                                     system("cls");
                                                   goto atas;
                                                                    }else if (ulang=='T'){
                                                         system("cls");
                                                         cout <<"-----------------\n";
                                                         cout <<"Terima Kasih ^-^.\n";
                                                                            cout <<"-----------------\n";
                                                                            cout <<"Nama  : Rizkia Assani\n";
                                                                            cout <<"NPM   : 11108724\n";
                                                         cout <<"Kelas :2KA06\n";}
                                                         else { cout <<"Input salah...!!! ULANGI."<<
                                     }
                                                 else if (jenis_bayar==0){
                                     system("cls");
                                                         goto atas;}
                                                         else if (jenis_bayar=='E'){
                                                              exit(0);}
                                                                                  else{cout <<"Pilihan Salah...!!! ULANGI.";}
                                                              break;
                                                             
            case 'E':
            exit(0);
                break;
            default :{cout <<"Pilihan Salah...!!! ULANGI."<<
            }         
getch ();
return 0;
}

Tidak ada komentar:

Posting Komentar