ok so i have a new problem with the things underlined. getdata says 18 IntelliSense: more than one instance of overloaded function "getData" matches the argument list:
function "getData(std::ifstream &inData, <error-type> *theMenu)"
function "getData(std::ifstream &inData, menuType *theMenu)"
argument types are: (std::ifstream, menuType [26]) c:\Users\Owner\Documents\Visual Studio 2013\Projects\ConsoleApplication1\ConsoleApplication1\Source.cpp 46 2 ConsoleApplication1
showmenu says 19 IntelliSense: no instance of overloaded function "showMenu" matches the argument list
argument types are: (menuType) c:\Users\Owner\Documents\Visual Studio 2013\Projects\ConsoleApplication1\ConsoleApplication1\Source.cpp 54 3 ConsoleApplication1
menulist says 20 IntelliSense: no suitable conversion function from "menuType" to "menuType *" exists c:\Users\Owner\Documents\Visual Studio 2013\Projects\ConsoleApplication1\ConsoleApplication1\Source.cpp 57 19 ConsoleApplication1
I cannot find any problems with the code.
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 108 109 110 111 112 113 114
|
#include <iostream>
#include <fstream>
#include <stdlib.h>
#include <string>
#include <iomanip>
using namespace std;
const int a = 26;
// This global constant should always be equal to the number of items on the menu.
// If the menu is altered, adjust ?a? accordingly.
void getData(ifstream & inData,menuType theMenu[]);
void showMenu(menuType menulist1[]);
void getCheck(checkType & final_check, menuType menu[]);
struct menuType{
string menuitem;
double menuprice;
int num_ordered;
};
struct checkType{
menuType menu[a];
double totalPrice;
double tax;
double amount_due;
int customer_num;
};
int main()
{
cout << "**************************************" << endl;
cout << "Blocks Restaurant" << endl;
cout << "**************************************\n\n" << endl;
menuType menulist[a];
ifstream inFile;
bool done = false;
inFile.open("dinermenu.txt");
getData(inFile, menulist);
checkType check;
check.customer_num = rand() % 100 + 1;
char cont;
while(!done)
{
showMenu(menulist[a]);
getCheck(check, menulist[a]);
for(int i = 0; i < a; i++)
{
if(check.menu[i].num_ordered > 0)
{
cout << check.menu[i].num_ordered << " " << check.menu[i].menuitem << " $" << check.menu[i].menuprice << endl;
}
}
check.customer_num++;
cout << "Would you like to order again? (Y/N)" << endl;
cin >> cont;
if (cont == 'n' || cont == 'N')
{
done = true;
}
system("cls");
}
inFile.close();
return 0;
}
void getData(ifstream & inData, menuType theMenu[])
{
for (int i = 0; i < a; i++)
inData >> theMenu[i].menuitem >> theMenu[i].menuprice;
}
void getCheck(checkType & final_check, menuType menu[])
{
for (int i = 0; i < a; i++)
{
final_check.totalPrice = final_check.totalPrice + (menu[i].menuprice * menu[i].num_ordered);
final_check.menu[i] = menu[i];
final_check.menu[i].menuprice = menu[i].menuprice * menu[i].num_ordered;
}
final_check.tax = final_check.totalPrice * 0.08;
final_check.amount_due = final_check.tax + final_check.totalPrice;
}
void showMenu(menuType menulist1[])
{ for (int i=0; i < a; i++)
{
cout << setw (30)<< left << menulist1[i].menuitem << "$";
cout << right << menulist1[i].menuprice << "\n" << endl;
}
|