hi all,
nice to meet u again. I need your help on this code, which is the programme i still failed to compile.

#include<iostream>
#include<iomanip>
#include<string>
using namespace std;

// Define Struct

struct menuItemType
{
	string menuItem;
	double menuPrice;
};

void printCheck(int compMenuList[], int counter2);
void getData(int compMenuList[], int counter1);
void showMenu();

int main()
{
	int menuSelection[8];
	int counter = 0;

	showMenu();

	getData(menuSelection, counter);
	
	printCheck(menuSelection, counter);

	return 0;

}

void showMenu()
{
	cout << "Welcome to Johnny's Resturant." << endl;
	cout << endl;
	cout << "(1)Plain Egg" << setw(20) << setfill(' ') << "$1.45" << endl;
	cout << "(2)Bacon and Egg" << setw(20) << setfill(' ') << "$2.45" << endl;
	cout << "(3)Muffin" << setw(20) << setfill(' ') << "$0.99" << endl;
	cout << "(4)French Toast" << setw(20) << setfill(' ') << "$1.99" << endl;
	cout << "(5)Fruit Basket" << setw(20) << setfill(' ') << "$2.49" << endl;
	cout << "(6)Cereal" << setw(20) << setfill(' ') << "$0.69" << endl;
	cout << "(7)Coffee" << setw(20) << setfill(' ') << "$0.50" << endl;
	cout << "(8)Tea" << setw(20) << setfill(' ') << "$0.75" << endl;
	cout << endl;
	cout << "Enter the number corresponding with your choice then press the space bar. Enter -999 to stop." << endl;
	cout << endl;

}

void getData( int compMenuList[], int counter1)
{
	counter1 = 0;

	cout << "Enter the menu choice(s): ";

	for(counter1 = 0; counter1 < 7; counter1++)
	{
		cin >> compMenuList[counter1];

		if(compMenuList[counter1] = -999)
			break;
	}

	

}

void printCheck(int compMenuList[], int counter2)
{
	menuItemType menuList[8];
	int i;
	int j;
	double sum = 0;
	double amountDue;
	double taxAmount;

	for(i = 0; i < counter2; i++)
	{
		switch(compMenuList[i])
		{
		case 1:
			menuList[i].menuItem = "Plain Egg";
			menuList[i].menuPrice = 1.45;
			break;
		case 2:
			menuList[i].menuItem = "Bacon and Egg";
			menuList[i].menuPrice = 2.45;
			break;
		case 3:
			menuList[i].menuItem = "Muffin";
			menuList[i].menuPrice = 0.99;
			break;
		case 4:
			menuList[i].menuItem = "French Toast";
			menuList[i].menuPrice = 1.99;
			break;
		case 5:
			menuList[i].menuItem = "Fruit Basket";
			menuList[i].menuPrice = 2.49;
			break;
		case 6:
			menuList[i].menuItem = "Cereal";
			menuList[i].menuPrice = 0.69;
			break;
		case 7:
			menuList[i].menuItem = "Coffee";
			menuList[i].menuPrice = 0.50;
			break;
		case 8:
			menuList[i].menuItem = "Tea";
			menuList[i].menuPrice = 0.75;
			break;
		default:
			break;
		}
	}

	
	cout << "Welcome to Johnny's Resturant" << endl;
	cout << endl;

	for(j = 0; j <= i; j++)
	{
		cout << menuList[j].menuItem << setw(20) << setfill(' ') << "$" << menuList[j].menuPrice << endl;

		sum = sum + menuList[j].menuPrice;
	}

	taxAmount = sum * 0.05;
	amountDue = (sum * 0.05) + sum;

	cout << "Tax" << setw(20) << setfill(' ') << "$" << taxAmount << endl;
	cout << "Amount Due" << setw(20) << setfill(' ') << "$" << amountDue << endl;
}

Which one do you actually want, this C++ version (which isn't in the right spot anyway) or the other C version? It's very confusing when things are posted that way.

This article has been dead for over six months. Start a new discussion instead.