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();
 {

 }
}

Are you sure all those strings fit into 19 characters? (at the beginning where you use strcpy)

You are using C++ so I might suggest a more flexible way of storing a string, specifically the C++ string class.

#include <string>

int main()
{
   std::string input = "Whatever length you want, and some member functions to operate on it.";
}

--edit--

Oh wait you're using Borland C++. Well you may need a newer compiler, your compiler produces 16 bit executables if I'm not mistaken. It probably doesn't have a lot of the newer C++ language features and is extremely outdated by modern standards.

GCC and Visual Studio 2010 Express edition are both free.

#include<string.h>

Bad, bad.

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.

I don't see anything wrong with line 121: if((command == UP) && (wherey() > 2)) nor line 129: } But on 119: while(command != 17); if command == 17 you have yourself an tight endless loop. You might want to get rid of the ;

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.