I can't execute a C++ program, help!

My professor gave me a code with no errors.
When I compile it's fine, it doesn't show any errors, but when I try to execute it shows this:

line 3: syntax error near unexpected token '('
line 3: 'int main()'

I searched through the Internet but I couldn't find any solution. Please!!!
Someone suggested to try with another computer, but I don't have any other computer I can try to execute the program with.

Homework and coursework questions can only be posted in the Homework & Coursework forum and must include a completely filled out homework template as described in special homework rules.

Please review the rules, which you agreed to when you registered, if you have not already done so.

If the following suggestion doesn't solve your problem, please repost your question in the proper forum with a filled out template.

What is the name of your C++ source file? What command did you use to compile the source code to your C++ program?

If your source file is named program.cpp and you compiled it using the command:

make program

that would create an executable file named program and you would execute it with the command:

program

or, depending on how your PATH environment variable is set:

./program

If you built it with something like:

gcc program.cpp

that would create executable file named a.out and you would execute it with one of:

a.out

or:

./a.out

From the error message you provided it looks like you tried to execute the source file ( program.cpp ) instead of the compiled object file ( program or a.out ).

Hope this helps.