Must Declare "Spencer" in Scope

I'm trying to make a joke for my friends, and it says I must declare "Spencer" in the scope, how do i go about doing this?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <iostream>
#include <string>
using namespace std;
int main()
{
  string name;
  cout<<"Please enter your name:";
  cin>>name;

  if (name == Garrett) {
    cout<<"Hey, how ya doing sexy?";
  }

else if    (name == Spencer) {
    cout<<"Go home.";
}
return 0;
}

The Error Messages:
1
2
3
4
C:\Users\Spencer\Documents\Le Programming\Hello world\main.cpp||In function 'int main()':|
C:\Users\Spencer\Documents\Le Programming\Hello world\main.cpp|10|error: 'Garrett' was not declared in this scope|
C:\Users\Spencer\Documents\Le Programming\Hello world\main.cpp|14|error: 'Spencer' was not declared in this scope|
||=== Build finished: 2 errors, 0 warnings (0 minutes, 0 seconds) ===|
You are trying to use variables named Garrett and Spencer without having first declared them.

But I think you would rather compare name to the string literals "Garrett" and "Spencer".

if (name == "Garrett") {

else if (name == "Spencer") {

Hope this helps.
Also the comparison will fail if they enter something like "garrett" instead of "Garrett".
You could deal with this by doing:

if (name == "Garrett" || name == "garrett")
Topic archived. No new replies allowed.