Quick c++ question please!?
hence this code i have written listed below doesn’t make on codeblocks and was wanting to know if someone could assist me resolve the errors so it would make.thank!!!
Take drinkchoiceSIZE.drinkname
= “Cola”, “Root Beer”, “Lemon-Lime”,
“Orange”, “Iced Tea”;
Take costSIZE.drinkcost
= “0.75”, “0.75”, “0.75”,
“0.85”, “1.25”;
Take drinksamountSIZE.numofdrinks
= “20”, “20”, “20”,
“20”, “20”;
cout << "Drink identify Cost Selection in Machine" << endl;
cout << "———- —- —————–" << endl;
for (int when i = 0; when i < DIMENSIONS; i++)
cout << drinkchoicei.drinkname << setw(10) << costi.drinkcost << " " << drinksamounti.numofdrinks << endl;
Here’s the particular code (Modified)
I have run the particular code, this works flawlesly
#include
#include
#include
utilizing namespace an std;
const int DIMENSIONS = 5 VARIOUS;
struct Drink
chain drinkname;
twice drinkcost;
int numofdrinks;
;
int main()
Take drinkchoice5;
chain arr5 = “Cola”, “Root Beer”, “Lemon-Lime”, “Orange”, “Iced Tea”;
for(int i=0; i<5; i++)
drinkchoicei.drinkname= arri;
Take cost5;
twice arr_cost5 = 0.75, 0.75, 0.75, 0.85, 1.30;
for(int i=0; i<5; i++)
costi.drinkcost=arr_costi;
Take drinksamount5;
int arr_num5 = TWENTY, 20, TWENTY, 20, TWENTY;
for(int i=0; i<5; i++)
drinksamounti.numofdrinks= arr_numi;
cout << "Drink identify Cost Selection in Machine" << endl;
cout << "———- —- —————–" << endl;
for (int when i = 0; when i < DIMENSIONS; i++)
cout << &drinkchoicei.drinkname << setw(10) << &costi.drinkcost << " " << &drinksamounti.numofdrinks << endl;
gain 0;
Expectation this assists, Thanks
struct Take drinkchoice
chain drinknameSIZE, drinkcostSIZE, numofdrinksSIZE
;
today u could directly assign the particular values.
Leave a Reply
You must be logged in to post a comment.