Fairly simple c++ question.

From: Jack. (jack_at_jack.com)
Date: 12/22/03

Date: Mon, 22 Dec 2003 17:43:05 +0000


I haven't been learning C++ for too long, but I'm having trouble with
a simple program in the book I've been learning from. Can you tell me
why I receive error message "parse error before '<<' token" in this
code? (I've marked line 18 for reference, I didn't try to compile it
with that in). If it helps any, I'm currently using dev-c++, from

#include <iostream.h>
int Add (int x, int y)
 cout << "In Add(), received " << x << " and " << y << "\n";
 return (x+y);

int main()
        cout << "I'm in main()!\n";
        int a, b, c;
        cout << "Enter two numbers: ";
        cin >> a;
        cin >> b;
        cout << "\nCalling Add()\n";
        cout << "\nBack in main().\n"
        cout << "c was set to " << c; (<---- Line 18)
        cout << "\nExiting...\n\n";
         return 0;

Relevant Pages

  • Re: Some Advice.
    ... > int main{ ... Yes I am learning that and and implementing as I go along. ... you should provide inclusion guards for headers. ... > function definitions into separate source files. ...
  • Re: A problem about [Data types:string] -Need help!
    ... > int main ... find yourself learning antiquated C++ that doesn't conform to the modern ... standard. ...
  • Newbie help with C++
    ... I have just started learning c++ and I'm having a problem with this small ... pice of code ... int main ...
  • Re: Visual C++ vs Visual C#
    ... idea of learning C++ without learning C to be fraught with the same ... int main ... using namespace std; ... We've added namespaces and shift operators for no gain, ...
  • Re: Store a file as an integer
    ... I have recently started learning to program using Java, ... > how do I fix it? ... The error is because you're saying the int x is a FileReader object which it ...