A small store only sells Coke 1.5 liters and San Miguel 1 liter, Make a program that will input type of item and number of item, C-for Coke with a price of 65.00 and S- for San Miguel with a price of 120.00. Compute and display the total amount, and your program will be terminated if you input T in the type of item.
#include<iostream>
using namespace std;
int main()
{
char option;
int amt;
double price;
cout<<"Enter the item you want to buy\nC for Coke\nS for San miguel"<<endl;
cin>>option;
if(option=='C'||option=='c'){
cout<<"Enter the number of coke you want to buy: ";
cin>>amt;
price=amt*65.00;
cout<<"The total amount is: "<<price;
}
else if(option=='S'||option=='s'){
cout<<"Enter the number of San Miguel you want to buy: ";
cin>>amt;
price=amt*120.00;
cout<<"The total amount is: "<<price;
}
else if(option=='T'||option=='t'){
cout<<"End of program";
}
}
Comments
Leave a comment