Write a program that stores the following data USE IN C++

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Write a program that stores the following data USE IN C++

Post by answerhappygod »

Write a program that stores the following data USE INC++
Write A Program That Stores The Following Data Use In C 1
Write A Program That Stores The Following Data Use In C 1 (63.86 KiB) Viewed 48 times
Write A Program That Stores The Following Data Use In C 2
Write A Program That Stores The Following Data Use In C 2 (74.08 KiB) Viewed 48 times
Write A Program That Stores The Following Data Use In C 3
Write A Program That Stores The Following Data Use In C 3 (49.92 KiB) Viewed 48 times
Vending Machine options: [0] Coke (can)...$0.75 [1] Coke (bottle)...$1.25 [2] Sprite (bottle)...$1.25 [3] Water...$1.25 [4] Red Bull...$2.00 Enter your choice (-1 to quit): 0 The price is: $0.75 Enter your choice (-1 to quit): 4 The price is: $2.00 Enter your choice (-1 to quit): 0 The price is: $0.75 Enter your choice (-1 to quit): 1 The price is: $1.25 Enter your choice (-1 to quit): 0 The price is: $0.75 Enter your choice (-1 to quit): 0 Sold out! Enter your choice (-1 to quit): 2 The price is: $1.25 Enter your choice (-1 to quit): -1 Amount earned by machine: $6.75 #include #include using namespace std; const int COUNT1=3; const int NumOfDrinks=5; struct DrinkData//struct DrinkData string name:
void showChoices(DrinkData drinkList[5])//function showChoices cout<<"Vending Machine options": cout<<"\n[0] Coke (can)...$0.75"; cout<<"\n[1] Coke (bottle)...$1.25"; cout<<"\n[2] Sprite (bottle)...$1.25"; cout<<"\n[3] Water...$1.25"; cout<<"\n[4] Red Bull...$2.00"; int choice; dol cout<<"\nEnter your choice (-1 to quit):"< cin>>choice; if(choice!=-1){ if(drinklist[choice].quantityLeft==0) cout<<"Sold out!"; else{ cout<<"The price is: $*< drinkList[choice].quantityLeft-; 1 1 while(choice!=-1); 1 void calculate Earnings(DrinkData drinkList[5]//function calculateEarnings double sum=0; for(int i=0;i<5;i++){ sum-drinkList price*(COUNT1-drinkList.quantityLeft): } cout<<"Amount earned by machine: $"<) int main(//main coute DrinkData drinkList[5]: drinklist[0] name="Coke (can)" drinkList(01.price=075
int mainQ/main couts DrinkData drinkList[5]; drinklist[0] name "Coke (can)"; drinkl ist[0] price 0.75; drinklist[0].quantityLeft COUNTI drinkList[1] name="Coke (bottle)"; drinkt ist[1] price 1.25; drinklist[1] quantityLeft-COUNTI; drinklist[2] name="Sprite (bottle)"; drinki ist[2] price-125; drinkt ist(2) quantityLeft-COUNTI: drinkList[3] name="Water"; drinkt ist[3] price-1.25; drinktist[3) quantityLeft-COUNTE drinkd.ist(4) name="Red Bull, drinklist/4) price-2.00; drinki ist(4) quantityLeft-COUNTI showChoices(drinkt ist)://call function showChoices calculateEamningsidrinktist)call function calculateEarnings T return 0 code is in C++1 am getting the following errors Program generated too much output Output restricted to 50000 characters. Check program for any unterminated loops baktedindofstream& main cpp 69:36: error:void value not ignored as it ought to be doub O
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply