Professional Documents
Culture Documents
Candy
Candy
#include <iostream>
#include <fstream>
#include <string>
//variables
char menuOption;
int candyType;
int peeps;
int totalPeeps;
int jellybeans;
int totalJellybeans;
int chocolate;
int totalChocolate;
int other;
int totalOther;
int totalCandy;
int candyAmount;
//main function
int main() {
cout<<"----------"<<endl;
cout<<"** My Candy Database **"<<endl;
menu(); //calling menu before loop begins
do{
cout<<"Please make a selection from the menu: ";
cin>>menuOption;
if(menuOption=='E' || menuOption=='e') { //statement that calls functions
based on input command
eat(candyType, candyAmount);
} else if(menuOption=='F' || menuOption=='f') {
find(candyType, candyAmount);
} else if(menuOption=='I' || menuOption=='i') {
inventory(candyType, totalCandy);
} else if(menuOption=='C' || menuOption=='c') {
types();
} else if(menuOption=='M' || menuOption=='m') {
menu();
} else if(menuOption=='S' || menuOption=='s') {
save();
} else if(menuOption=='L' || menuOption=='l') {
load();
} else if(menuOption=='Q' || menuOption=='q') {
cout<<"Don't eat too much all at once!"<<endl;
} else {
cout<<"That is not a valid selection. Try again!"<<endl;
}
} while(menuOption!='Q');
return 0;
}