0

I keep getting this error and cant figure it out
thanks for the input.


runcs216p6.cxx: In function `int main()':
runcs216p6.cxx:57: error: parse error before `catch'

int main()
{

  ifstream inFile;
  ofstream outFile;

  inFile.open("in.data");
  outFile.open("out.data");
  if(inFile.fail() || outFile.fail())
  {
     cout << "input or out file opening failed" << endl;
     exit(1);
  }

  char n;
  int counter;

  counter = 0;

  StackType s;
  Queue q;

  inFile >> n;

  while(inFile)
  {
    if(s.IsFull())
      throw "~~Stack Overflow! No Push!";
    if(q.IsFull())
      throw "~~Queue Overflow! No Enqueue!";
    else{
      s.Push(n);
      q.Enqueue(n);
      outFile << n;
      counter++;}

  inFile >> n;
  }
 catch(std::char * s)
    {
    outFile<<s;
    }
return 0;
}
2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by Ancient Dragon
0

>>catch(std::char * s)

Error most likely because there is no such thing as std::char. change to this and retest: catch(const char* s)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.