Contoh program menghitung harga menu c++

menghitung harga menu c++

Kali ini saya akan share contoh program sederhana yaitu contoh program menghitung harga menu makanan dengan c++ semoga bermanfaat.

#include <iostream>


using namespace std;



main()

{



int menu;

long int harga, total, cml;

cout<<"********FRESH********"<<endl;

cout<<"1.Juice"<<endl;

cout<<"2.Softdrink"<<endl;

cout<<"3.Milk Shake"<<endl;

cout<<"4.Tiramisu"<<endl;

cout<<"5.Cookies Cream"<<endl;





 cout<<"Masukan Fresh Menu Yang Ingin Anda Pesan [1/2/3/4/5]=";

 cin>>menu;



 switch(menu)

 {

  case 1:

      harga=10000;

   cout<<"Juice"<<endl;

   cout<<"Harga = 10000"<<endl;

   cout<<"Jumlah Beli = ";

   cin>>cml;

   total=harga*cml;

   if(cml>=2)

    {

        total= total-(total*10/100);

    }



    else if (cml<2)

        {

            total=harga*cml;

        }

   cout<<"Total Harga Uang Harus Dibayar ="<<total;

  break;



  case 2:

   harga=15000;

   cout<<"Soft Drink"<<endl;

   cout<<"Harga = 15000"<<endl;

   cout<<"Jumlah Beli = ";

   cin>>cml;

   total=harga*cml;

   if(cml>=2)

    {

        total= total-(total*10/100);

    }



    else if (cml<2)

        {

            total=harga*cml;

        }

   cout<<"Total Harga Uang Harus Dibayar ="<<total;

  break;



  case 3:

      harga=20000;

   cout<<"Milk Shake"<<endl;

   cout<<"Harga = 20000"<<endl;

   cout<<"Jumlah Beli = ";

   cin>>cml;

   total=harga*cml;

   if(cml>=2)

    {

        total= total-(total*10/100);

    }



    else if (cml<2)

        {

            total=harga*cml;

        }

   cout<<"Total Harga Uang Harus Dibayar ="<<total;

  break;



  case 4:

      harga=18000;

   cout<<"Cookies Cream"<<endl;

   cout<<"Harga = 18000"<<endl;

   cout<<"Jumlah Beli = ";

   cin>>cml;

   total=harga*cml;

   if(cml>=2)

    {

        total= total-(total*10/100);

    }



    else if (cml<2)

        {

            total=harga*cml;

        }

   cout<<"Total Harga Uang Harus Dibayar ="<<total;

  break;



        case 5:

            harga=16000;

   cout<<"Cookies Cream"<<endl;

   cout<<"Harga = 16000"<<endl;

   cout<<"Jumlah Beli = ";

   cin>>cml;

   total=harga*cml;

   if(cml>=2)

    {

        total= total-(total*10/100);

    }



    else if (cml<2)

        {

            total=harga*cml;

        }

   cout<<"Total Harga Uang Harus Dibayar ="<<total;

  break;



 default:

  cout<<"Pesanan Tidak Tersedia Di Menu";

 break;

 }
}

Leave A Comment