A drink costs 2 dollars. A taco costs 4 dollars. Given the number of each, compute total cost and assign totalCost with the result. Ex: 4 drinks and 6 tacos yields totalCost of 32.
int drinkCount = 4, tacoCount = 6;
// std::cin>>drinks >> tacos; // you may read values from input stream
int drinkCost = 2, tacoCost = 4;
int totalCost = drinkCount * drinkCost + tacoCount * tacoCost ;
// std::cout << totalCost; // you may want print total cost
Comments
Leave a comment