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 98 99 100 101 102 103 104 105 106 107
|
#include <iostream>
#include <string>
#include<vector>
#include <fstream>
#include <fstream>
using namespace std;
class menu {
public:
menu()
{
fileCheck(appIn, "app.txt");
fileCheck(desIn, "des.txt");
fileCheck(drinkIn, "drink.txt");
fileCheck(entIn, "ent.txt");
getData(appIn, appName, appPrice);
getData(desIn, desName, desPrice);
getData(entIn, entName, entPrice);
getData(drinkIn, drinkName, drinkPrice);
}
void getData(ifstream& iFile, vector<string>& name, vector<double>& price)
{
string tempS;
double tempD;
while (!iFile.eof())
{
getline(iFile, tempS);
name.push_back(tempS);
iFile >> tempD;
price.push_back(tempD);
iFile.ignore();
}
}
void menuPrint()
{
int choice = 0;
double subtotal = 0;
double tax = 0;
double tip = 0;
int quantity = 0;
system("cls");
cout << "1. Appetizer Menu " << endl;
cout << "2. Drink Menu " << endl;
cout << "3. Entree Menu " << endl;
cout << "4. Dessert Menu " << endl;
cout << "Subtotal: $" << subtotal << endl;
cout << "Enter Selection: ";
cin >> choice;
if (choice == 1)
{
}
}
void fileCheck(ifstream& iFile, string text)
{
iFile.open(text);
if (!iFile.is_open())
{
cout << text << "file not found" << endl;
exit(1);
}
}
vector<string> appName, drinkName, entName, desName, soldName;
vector<double> appPrice, drinkPrice, entPrice, desPrice, soldPrice, subtotal, tax, tip;
vector<int> choice, soldQ;
ifstream appIn, desIn, entIn, drinkIn;
private:
};
int main()
{
menu tb;
return 0;
}
|