Music ku

Monday, March 07, 2011

answer no.1

#include <iostream.h>
main()
{
                int drink;
                double price;
                double money;
                double balance;

                cout<<"**********";
                cout<<"\n Mesin tin minuman";
                cout<<"\n ------------------";
                cout<<"\n 1 - pepsi\t\t 2.00\n 2 - coca cola\t\t2.00\n 3 - F&N MIRINDA \t1.80\n 4 - F&N ORANGE\t\t1.80\n 5 - 100 plus\t\t2.50";
                cout<<"\n *********";

cout<<"\n\n enter your drink";
cin>>drink;
cout<<"\n enter your money";
cin>>money;

 if (drink==1)
{
balance=money-2.00;
cout<<"\n your drink is pepsi";
cout<<"\n Balance is"<<balance;
}

else
if(drink==2)
{
balance=money-2.00;   
cout<<"\n your drink is coca cola";
cout<<"\n Balance is"<<balance;
}

else
if(drink==3)
{balance= money-1.80;
cout<<"\n your drink is F$N MIRINDA";
cout<<"\n Balance is"<<balance;}

else
if(drink==4)
{
balance = money-1.80;
cout<<"\n your drink is f&n orange";
cout<<"\n Balance is"<<balance;
}

else
if(drink==5)
{
balance=money-2.50;
cout<<"\n your drink is 100 plus";
cout<<"\n Balance is"<<balance;
}

else
{
                cout<<" \n Invalid selection. Try again";
}

return 0;
}

No comments:

Post a Comment