1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
|
#include<iostream>
#include<fstream>
#include<string>
#include <iomanip>
using namespace std;
struct
{
string appName, desName, drinkName, mcName; // create variables for appetizers
double appPrice, desPrice, drinkPrice, mcPrice;
int appQuantity, desQuantity, drinkQuantity, mcQuantity;
}menu[100];
struct
{
double tempSubTotal; // used as a temp variable to hold whatever price that we will push into our finalSubTotal.
double finalSubTotal;
}subTotal;
int mainMenu();
void appetizer(); // function prototypes
void appSelection();
void dessert();
void dessertSelection();
void SubTotal();
int main()
{
int counter = 1;
ifstream appInfo, desInfo, drinkInfo, mcInfo;
// Below reads from our file and stores our information into our struct
appInfo.open("app.txt");
while (!appInfo.eof())
{
getline(appInfo, menu[counter].appName);
appInfo >> menu[counter].appPrice;
appInfo >> menu[counter].appQuantity;
appInfo.ignore();
counter++;
}
appInfo.close();
desInfo.open("des.txt");
while (!desInfo.eof())
{
getline(desInfo, menu[counter].desName);
desInfo >> menu[counter].desPrice;
desInfo >> menu[counter].desQuantity;
desInfo.ignore();
counter++;
}
desInfo.close();
drinkInfo.open("drink.txt");
while (!(drinkInfo.eof()))
{
getline(drinkInfo, menu[counter].drinkName);
drinkInfo >> menu[counter].drinkPrice;
drinkInfo >> menu[counter].drinkQuantity;
drinkInfo.ignore();
counter++;
}
drinkInfo.close();
mcInfo.open("mc.txt");
while (!(mcInfo.eof()))
{
getline(mcInfo, menu[counter].mcName);
mcInfo >> menu[counter].mcPrice;
mcInfo >> menu[counter].mcQuantity;
mcInfo.ignore();
counter++;
}
mcInfo.close();
mainMenu();
system("pause");
return 0;
}
| |