Ok, I've been trying to run this program on Borland C++ (Version 5.0A). The program is a Point of Sale program. I keep getting the errors "expression syntax at (121,26)" and "If statement missing ) at (129,6). Try as I might, I can't seem to fix the errors. Help?
//Point of Sale Program
#include<conio.h>
#include<stdlib.h>
#include<fstream.h>
#include<iomanip.h>
#include<string.h>
#include"menu.h"
#include"apstring.h"
#include"apstring.cpp"
#define ESCAPE = 27
#define UP = 38
#define DOWN = 40
void Order();
void Total();
void Quit();
void DisplayList();
int command;
struct strucTemplate {
char name[20]; double price; int numberPurchased;
};
strucTemplate Items[5];
int main()
{
strcpy(Items[0].name, "Cats ");
Items[0].price = 1.99;
Items[0].numberPurchased = 0;
strcpy(Items[1].name, "Pinatas ");
Items[1].numberPurchased = 0;
Items[1].price = 4.99;
strcpy(Items[2].name, "Switchblades ");
Items [2].price = 3.99;
Items[2].numberPurchased = 0;
strcpy(Items[3].name, "Cake ");
Items [3].price = 9.99;
Items[3].numberPurchased = 0;
strcpy(Items[4].name, "PlasmaCutters ");
Items[4].numberPurchased = 0;
Items [4].price = 19.99;
_setcursortype(_NOCURSOR);
int command;
do{
menu Main(4,"=[","]=");
Main.heading("Please choose an option!");
Main.option(1,"Place Order");
Main.option(2,"Get Total");
Main.option(3,"Quit");
command = Main.create();
clrscr();
switch(command)
{
case 1:
Order();
break;
case 2:
Total();
break;
case 3:
Quit();
break;
}
}
while (command !=3);
system("color 25");
return 0;
}
void Order() {
do{
DisplayList();
system("cls");
} while(command != 27);
}
void DisplayList()
{
cout.setf(ios::showpoint);
cout.setf(ios::fixed);
gotoxy(4,2);
cout << "Press ESCAPE to exit." << endl;
gotoxy(1,4);
cout << " |-----------|-----------|-----------|-----------|" << endl;
for(int count = 0; count <5; count++){
cout << " | " << setw (11) << Items[count].name << "| " << setw(13) << setprecision(2) << Items[count].price << " | ";
cout << setw(9) << Items[count].numberPurchased << " |" << endl;
cout << " |-----------|-----------|-----------|-----------|" << endl;
}
gotoxy(0,2);
do{
cout << "=[";
command = getch();
gotoxy(wherex() - 2, wherey());
cout << " ";
gotoxy(wherex() - 2, wherey());
}
while(command != 17);
if((command == UP) && (wherey() > 2))
{
gotoxy(wherex(), (wherey() - 2));
}
if((command == DOWN) && (wherey() < 10)) {
gotoxy((wherex(), (wherey() + 2));
}
}
while(command != ENTER);
int itemSelected;
if (command != 27)
{
switch(wherey()){
case 2:
itemSelected = 0;
gotoxy(15, wherey());
cout << " ";
gotoxy(15, wherey());
cin >> Items[itemSelected].numberPurchased;
break;
case 4:
itemSelected = 1;
gotoxy(15, wherey());
cout << " ";
gotoxy(15, wherey());
cin >> Items[itemSelected].numberPurchased;
break;
case 6:
itemSelected = 2;
gotoxy(15, wherey());
cout << " ";
gotoxy(15, wherey());
cin >> Items[itemSelected].numberPurchased;
break;
case 8:
itemSelected = 3;
gotoxy(15, wherey());
cout << " ";
gotoxy(15, wherey());
cin >> Items[itemSelected].numberPurchased;
break;
case 10:
itemSelected = 4;
gotoxy(15, wherey());
cout << " ";
gotoxy(15, wherey());
cin >> Items[itemSelected].numberPurchased;
break;
}
while(command != 27);
}
system("color 16");
}
void Total()
{
system("color 09");
cout << " |===========|===========|===========|===========|" << endl;
for(int count = 0; count <5; count++){
cout << " | " << setw (11) << Items[count].name << "| " << setw(13) << setprecision(2) << Items[count].price << " | ";
cout << setw(9) << Items[count].numberPurchased << " |" << endl;
cout << " |===========|===========|===========|===========|" << endl;
}
void Quit();
{
}
}