main()
{
//declare
int selection;
float money,balance,price,addmmoney,add;
//out
cout<<"\n******************";
cout<<"\nMesin Tin Minuman";
cout<<"\n------------------";
cout<<"\n1.PEPSI";
cout<<"\n2.COCA COLA";
cout<<"\n3.F&N MIRINDA";
cout<<"\n4.F&N ORANGE";
cout<<"\n5.100 PLUS";
cout<<"\n******************";
//input
cout<<"\nPlease Choose Your Drink=";
cin>>selection;
cout<<"\nPlease Enter MONEY: ";
cin>>money;
switch (selection)
{
case 1: cout<<" Your drink is Pepsi";
price = 2.00;
break;
case 2: cout<<" Your drink is Coca Cola";
price = 2.00;
break;
case 3: cout<<" Your drink is F&N Mirinda";
price = 1.80;
break;
case 4: cout<<" Your drink is F&N Orange";
price = 1.80;
break;
case 5: cout<<" Your drink is 100 Plus";
price = 2.50;
break;
default: cout<<"invalid selection";
}
if (money>price)
{
balance = money - price;
}else if (money<price)
{
add = price - money;
cout<<"Please add (RM" <<add<< ")= ";
cin>>addmoney;
balance = money + addmoney;
}
cout<<"Your balance is ";
return 0;
}
No comments:
Post a Comment