cin with multiple words

First off sorry im sure thas has been asked lots. I cannot for the life of me get cin to recognize my words, ive been at this for hours Im really stumped. The problems are near the bottom. Just looking for whats wrong and how to fix it. Any help appreciated thanks.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#include <iostream>
#include <string>

using namespace std;

		void startgame()
{
	
cout << "Welcome to Umph land V0.0 \n\n" << "This is an oldschool RPG, let your intuition be your guide. \n\n" << endl;
cout << "Once their was a mighty Hero, in a war torn land. His journey began here... \n";
cout << "CONTROLS 1 = use" << endl;
	
}



		int playerstats()
{
	
int spec;
int stamina;
int agility;
int intellect;
int luck;

cout << "Select Class Stats to View" << endl;
cout << "1 = Warrior" << endl;
cout << "2 = Mage" << endl;
cout << "3 = Rogue" << endl;
cout << "4 = Priest" << endl;

cin >> spec;

	if (spec == 1)
	{stamina = 4, agility = 2, intellect = 0, luck = 2;}
	
	else if (spec == 2)
	{stamina = 1, agility = 1, intellect = 4, luck = 3;}
	
	else if (spec == 3)
	{stamina = 1, agility = 4, intellect = 1, luck = 4;}
	
		else if (spec == 4)
	{stamina = 1, agility = 0, intellect = 5, luck = 2;}
	
cout << "Current Class Stats \n\n" << endl;
cout << "Stamina = " << stamina << "     ";
cout << "Intellect = " << intellect << endl;
cout << "Agility = " << agility << "     ";
cout << "Luck = " << luck << endl;

	return 0;
}


		int main ()
{

string action = "";

startgame();

cout << "You awaken feeling rested at the tavern." <<  endl;
cout <<  "You hear chatter and laughter outside the small room. You see a door, a window, and a chest." << endl;	
cout << "You find your rusty iron knife and clothes then procceed to gear up";

getline(cin, action);

if(action = "open chest")
{
playerstats();
}


	return 0;
}
Last edited on
Line 69, if(action = "open chest") , should be if(action == "open chest")
Thank you my man!
Topic archived. No new replies allowed.