Sunday, April 1, 2012

Membuat Program C++ Dengan judul " PENGHITUNG PENJUALAN BBM"
waah ternyata perhitungan penjualan apapun jenisnya bisa loh di buat program contohnya seperti di bawah ini walupun programnya sangat sederhana ga' apa dech siapa tau bermanfa'at hehehe amin ...
Nah ini contohnya :
Program Listing
 

#include<iostream.h>
#include<conio.h>
#include<math.h>
main()
{
            int Pilihan;
   double P,np,Tot,etj,aj;
   clrscr();
   cout<<"Selamat Datang di Resto Murah Tapi Mantap\n";
   cout<<"-----------------------------------------\n";
   cout<<"\n";
   cout<<"Daftar Menu Makanan\n";
   cout<<"~~~~~~~~~~~~~~~~~~~\n";
   cout<<"1.Paket Hemat\n";
   cout<<"2.Paket Mantap\n";
   cout<<"3.Paket Jumbo\n";
   cout<<"4.Double Jumbo\n";
   cout<<"5.Paket Family\n";
   cout<<"-------------------\n";
   cout<<"Masukkan Menu Makanan : ";cin>>Pilihan;
   cout<<"-------------------\n";
   switch(Pilihan)
   {
            case 1:
            cout<<"Paket Hemat\n";
         cout<<"~~~~~~~~~~~\n";
         cout<<"Harga : Rp5.000,00\n";
         cout<<"Porsi : ";cin>>P;
         cout<<"--------------\n";
         int Tambahan;
         cout<<"1.Nasi Putih\n";
         cout<<"2.Es Teh/Jeruk\n";
         cout<<"3.Aneka Jus\n";
         cout<<"--------------\n";
         cout<<"Tambahan : ";cin>>Tambahan;
         switch(Tambahan)
         {
            case 1:
                        cout<<"Nasi Putih\n";
               cout<<"--------------\n";
               cout<<"Harga : Rp2.000,00\n";
               cout<<"Porsi : ";cin>>np;
            break;
            case 2:
                        cout<<"Es Teh/Jeruk\n";
               cout<<"--------------\n";
               cout<<"Harga : Rp2.000,00\n";
               cout<<"Porsi : ";cin>>etj;
            break;
            case 3:
                        cout<<"Aneka Jus\n";
               cout<<"--------------\n";
               cout<<"Harga : Rp5.000,00\n";
               cout<<"Porsi : ";cin>>aj;
         }
         cout<<"--------------\n";
         Tot=(5000*P)+((2000*np)+(2000*etj)+(5000*aj));
         cout<<"Total = Rp"<<Tot<<",00\n";
         cout<<"\n";
         cout<<"Terima Kasih Telah Mengunjungi Rumah Makan Kami\n";
         cout<<"_______________________________________________\n";

      break;
      case 2:
            cout<<"Paket Mantap\n";
         cout<<"~~~~~~~~~~~~\n";
         cout<<"Harga : Rp10.000,00\n";
         cout<<"Porsi : ";cin>>P;
         cout<<"--------------\n";
         cout<<"1.Nasi Putih\n";
         cout<<"2.Es Teh/Jeruk\n";
         cout<<"3.Aneka Jus\n";
         cout<<"--------------\n";
         cout<<"Tambahan : ";cin>>Tambahan;
         switch(Tambahan)
         {
         case 1:
            cout<<"Nasi Putih\n";
            cout<<"--------------\n";
            cout<<"Harga : Rp2.000,00\n";
            cout<<"Porsi : ";cin>>np;
         break;
            case 2:
            cout<<"Es Teh/Jeruk\n";
            cout<<"--------------\n";
            cout<<"Harga : Rp2.000,00\n";
            cout<<"Porsi : ";cin>>etj;
         break;
            case 3:
            cout<<"Aneka Jus\n";
            cout<<"--------------\n";
            cout<<"Harga : Rp5.000,00\n";
            cout<<"Porsi : ";cin>>aj;
         }
         cout<<"--------------\n";
         Tot=(10000*P)+((2000*np)+(2000*etj)+(5000*aj));
         cout<<"Total = Rp"<<Tot<<",00\n";
         cout<<"\n";
         cout<<"Terima Kasih Telah Mengunjungi Rumah Makan Kami\n";
         cout<<"_______________________________________________\n";

      break;
      case 3:
            cout<<"Paket Jumbo\n";
         cout<<"~~~~~~~~~~~~\n";
         cout<<"Harga : Rp15.000,00\n";
         cout<<"Porsi : ";cin>>P;
         cout<<"--------------\n";
         cout<<"1.Nasi Putih\n";
         cout<<"2.Es Teh/Jeruk\n";
         cout<<"3.Aneka Jus\n";
         cout<<"--------------\n";
         cout<<"Tambahan : ";cin>>Tambahan;
         switch(Tambahan)
         {
            case 1:
                        cout<<"Nasi Putih\n";
               cout<<"--------------\n";
               cout<<"Harga : Rp2.000,00\n";
               cout<<"Porsi : ";cin>>np;
            break;
            case 2:
                        cout<<"Es Teh/Jeruk\n";
               cout<<"--------------\n";
               cout<<"Harga : Rp2.000,00\n";
               cout<<"Porsi : ";cin>>etj;
            break;
            case 3:
                        cout<<"Aneka Jus\n";
               cout<<"--------------\n";
               cout<<"Harga : Rp5.000,00\n";
               cout<<"Porsi : ";cin>>aj;
         }
         cout<<"--------------\n";
         Tot=(15000*P)+((2000*np)+(2000*etj)+(5000*aj));
         cout<<"Total = Rp"<<Tot<<",00\n";
         cout<<"\n";
         cout<<"Terima Kasih Telah Mengunjungi Rumah Makan Kami\n";
         cout<<"_______________________________________________\n";

       break;
       case 4:
            cout<<"Double Jumbo\n";
         cout<<"~~~~~~~~~~~~\n";
         cout<<"Harga : Rp20.000,00\n";
         cout<<"Porsi : ";cin>>P;
         cout<<"--------------\n";
         cout<<"1.Nasi Putih\n";
         cout<<"2.Es Teh/Jeruk\n";
         cout<<"3.Aneka Jus\n";
         cout<<"--------------\n";
         cout<<"Tambahan : ";cin>>Tambahan;
         switch(Tambahan)
         {
            case 1:
                        cout<<"Nasi Putih\n";
               cout<<"--------------\n";
               cout<<"Harga : Rp2.000,00\n";
               cout<<"Porsi : ";cin>>np;
            break;
            case 2:
                        cout<<"Es Teh/Jeruk\n";
               cout<<"--------------\n";
               cout<<"Harga : Rp2.000,00\n";
               cout<<"Porsi : ";cin>>etj;
            break;
            case 3:
                        cout<<"Aneka Jus\n";
               cout<<"--------------\n";
               cout<<"Harga : Rp5.000,00\n";
               cout<<"Porsi : ";cin>>aj;
         }
         cout<<"--------------\n";
         Tot=(20000*P)+((2000*np)+(2000*etj)+(5000*aj));
         cout<<"Total = Rp"<<Tot<<",00\n";
         cout<<"\n";
         cout<<"Terima Kasih Telah Mengunjungi Rumah Makan Kami\n";
         cout<<"_______________________________________________\n";

      break;
      case 5:
            cout<<"Paket Family\n";
         cout<<"~~~~~~~~~~~~\n";
         cout<<"Harga : Rp45.000,00\n";
         cout<<"Porsi : ";cin>>P;
         cout<<"--------------\n";
         cout<<"1.Nasi Putih\n";
         cout<<"2.Es Teh/Jeruk\n";
         cout<<"3.Aneka Jus\n";
         cout<<"--------------\n";
         cout<<"Tambahan : ";cin>>Tambahan;
         switch(Tambahan)
         {
            case 1:
                        cout<<"Nasi Putih\n";
               cout<<"--------------\n";
               cout<<"Harga : Rp2.000,00\n";
               cout<<"Porsi : ";cin>>np;
            break;
            case 2:
                        cout<<"Es Teh/Jeruk\n";
               cout<<"--------------\n";
               cout<<"Harga : Rp2.000,00\n";
               cout<<"Porsi : ";cin>>etj;
            break;
            case 3:
                        cout<<"Aneka Jus\n";
               cout<<"--------------\n";
               cout<<"Harga : Rp5.000,00";
               cout<<"Porsi : ";cin>>aj;
         }
         cout<<"--------------\n";
         Tot=(45000*P)+((2000*np)+(2000*etj)+(5000*aj));
         cout<<"Total = Rp"<<Tot<<",00\n";
         cout<<"\n";
         cout<<"Terima Kasih Telah Mengunjungi Rumah Makan Kami\n";
         cout<<"_______________________________________________\n";

      break;
   default :
            cout<<"Anda Hanya Bisa Memilih Paket Yang Sudah Tersedia. (Pilih 1-5)!!!\n";
   break;
   }
            getch();
}




Selamat Mencoba guys :D.......

1 comments:

Unknown said...

makasih ya mbak blognya bermanfaat bwt saya
tapi ada gk mbak yg berisi rumus if else, math.h, for,while,while do, fungsi, array Dalam satu judul program
mnta tolong mbak soalnya saya ada tugas laporan pratikum
^_^

Post a Comment