#include <iostream>
using namespace std;
//Function declare
void displayMenu(void);
void getSelection (int &userChoice);
void processChoice (int userChoice);
float monitorCoke( float );
float monitorpep ( float );
float monitorcana ( float);
float monitorhire ( float ) ;
// variable declare and const
float option, cocaout, pepsiout ,canaout,pepleft,canaleft,cokeleft,hireout ,
pepfinal, cokefinal,
canafinal, hire,
hirefinal;
const float coke = 1000;
const float pep = 1000;
const float cana = 1000;
const float hires = 1000;
float get_option;
//Main
int main (void)
{
int userChoice = 0 ;
displayMenu (void);
getSelection(userChoice);
processChoice (userChoice);
monitorCoke( cocaout);
monitorpep ( pepsiout) ;
monitorcana ( canaout);
monitorhire ( hireout) ;
return 0;
}
//end main
//start function
void displaymenu(void)
{
cout << " Have a nice week. Each product will have 1000 pieces a week" <<endl;
cout << " 1. Coca-Cola : 1000 pieces" << endl;
cout << " 2. Pepsi : 1000 pieces" << endl;
cout << " 3. Canada Dry" << endl;
cout << " 4. Hires " << endl;
}
void getSelection (int &userChoice)
{
cout << "Please enter your choice:" << endl;
cin>> userChoice;
}
void processChoice (int userChoice)
{
if (option == 1.0)
{
cout<< "How many Coca-cola would you like: " << endl;
cin>> cocaout;
}
else if (option == 2.0 )
{
cout<< "How many Pepsi would you like: " << endl;
cin >> pepsiout;
}
else if ( option ==3.0 )
{
cout<< "How many Canada Dry would you like: " << endl;
cin >> canaout;
}
else if ( option == 4.0)
{
cout<< "How many Hires would you like: " << endl;
cin>> hireout;
}// end if
}
float monitorCoke( float cokeleft)
{
cocaout = 0;
cokeleft = coke;
while ( cocaout < cokeleft)
{
cokeleft = cokeleft - cocaout;
cout << " There are " << cokeleft << " Coca-cola left in the machine " << endl;
}
return cokeleft;
}
float monitorpep ( float pepleft)
{
pepsiout = 0 ;
pepleft = pep ;
while (pepsiout < pepleft)
{
pepleft = pepleft - pepsiout;
cout << " There are " << pepleft << "Pepsi left in the machine " << endl;
}
return pepleft;
}//end function monitorpep
float monitorcana ( float canaleft)
{
canaout = 0 ;
canaleft = canaleft - canaout ;
while (canaout < canaleft)
{
canaleft = canaleft - canaout;
cout << " There are " << canaleft << "Canada Dry left in the machine " << endl;
}
return canaleft;
}// end monitorcana
float monitorhire ( float hireleft)
{
hireout = 0 ;
hireleft = hire ;
while (canaout < canaleft)
{
hireleft = hireleft - hireout;
cout << " There are " << hireleft << "Hires left in the machine " << endl;
}
return hireleft;
}// end monitorhire
This time, I tried to fix all the error but then I have the error with displayvoid function, i don't know why though trying many solutions