String problem

I'm having problems with strings and an "if" statement, here is an example code, please help me if you can. Thank you.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <iostream>
using namespace std;

int main()
{
string CLASS_CHOICE;

cout << "Which class would you like to be? Archer, Knight, or Sorcerer?: "
cin >> CLASS_CHOICE;

if (CLASS_CHOICE == 'Archer')
{
//statement
}

return 0;

}


The problem I am having is the if statement...it says too many characters in character constant.
closed account (Dy7SLyTq)
you need "Archer". you use ' / ' with single characters and " / " with strings.
Thank you soooo much!!
You may need a semi colon at the end of line 8 ;) kidding. Just do what DTSCode said . Good luck :)
Topic archived. No new replies allowed.