Here’s the code, the only issue seems to be using cout on variables, specifically double ones, that have numbers in them, im not sure how it works, here’s the code:
#include <iostream>
using namespace std;
int main()
{
int drink;
int log1;// insert price for drink one; coffee
int log2;// insert price for drink two; lemonade
int log3;// insert price for drink three; coca cola
int log4;// insert price for drink four; boba tea
double price1 = 2.99;// set price for drink 1; coffee
double price2 = 1.50;// set price for drink 2; lemonade
double price3 = 3.50;// set price for drink 3; coca cola
double price4 = 4.99;// set price for drink 4; boba tea
cout << "1.coffee" <<endl;
cout << "2.lemonade" <<endl;
cout << "3.coca cola" <<endl;
cout << "4.boba tea" << endl;
cout << "select a drink number: ";
cin >> drink; // where the drink is selected; from the 4 options avalable
if (drink == 1)// price testing for drink 1; coffee
{
cout << " price:"
cout << price1;
cout << endl;
cout << " insert money: "
cin >> log1;
}
else if (drink == 2)// price testing for drink 2; lemonade
{
cout << " price:"
cout << price2;
cout << endl;
cout << " insert money: "
cin >> log2;
}
else if (drink == 3)// price testing for drink 3; coca cola
{
cout << " price:"
cout << price3;
cout << endl;
cout << " insert money: "
cin >> log3;
}
else if ( drink == 4)//price testing for drink 4; boba tea
{
cout << " price:"
cout << price4;
cout << endl;
cout << " insert money: "
cin >> log4;
}
switch (drink)//drink outputs
{
case 1:
cout << "coffee dispensed";
break;
case 2:
cout << "lemonade dispensed";
break;
case 3:
cout << "coca cola dispenced";
break;
case 4:
cout << "boba tea dispensed";
break;
}
}