Syntax Error: Expected an expression.

I'm getting a syntax error on the second << (the one just after FIRSTNAME) in the second line of instructor provided code. I don't know what I'm doing wrong. All I want to do is print my first and last name. I know it's a funny way to print my name in a program but its the requirements for the assignment. I'm supposed to create a date.h file and define FIRSTNAME and LASTNAME so they print out my name. This is my first post and I'm very new to c++, so please forgive my ineptitude.

Instructor provided code below is unalterable,

1
2
3
4
5

  cout << "\n" << FIRSTNAME << " " << LASTNAME << "\nnow running the"
       << "\nDate Testing Program"
       << "\n====================\n\n";


I also have included a .h file that defines FIRSTNAME and LASTNAME. Code below,

1
2
3
4
5
6
7

#define FIRSTNAME
#define LASTNAME

FIRSTNAME string Aron; 
LASTNAME string Closson;
Last edited on
Hello And welcome to the forum. Please Edit your post, and put all of the code between code tags <> . The button is under the format section

cout << "\n" << FIRSTNAME ** << ** " " << LASTNAME

What are you expecting this to print out? Because this doesnt make a whole lot of sense. Could you tell us What you are trying to do?

Edit: I know its your first post ever. It says so in your first post ever :D dont need to apologize.
Although you're gonna have to answer my question if Im gonna be able to help you.
Last edited on
Sorry, first post ever.
Last edited on
I used the ** just to point out where the error was, its not really in my code. All I want to do is print out my name. I defined FIRSTNAME and LASTNAME in a separate date.h file.
I figured it out.

Source.cpp code:
1
2
3
  cout << "\n" << FIRSTNAME << " " << LASTNAME << "\nnow running the"
       << "\nDate Testing Program"
       << "\n====================\n\n";


Date.h code:
1
2
#define FIRSTNAME "Aron"
#define LASTNAME "Closson" 
Topic archived. No new replies allowed.