Storing characters in a variable and if statment

I'm pretty new to C++ and wanted to create a text based RPG.
But i have never learned how to store text like inventory = "banana". and i can only seem to as an if for a full word not two seperate ones. I hope i can get some help. i've set in some examples in my messy code. hope it's readable/understandable
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
  /*
			Body of room 1
*/

#include <iostream>
#include <string>
#include <cstdlib>
#include "headerRpg.h"

using namespace std;

//variables
char userInput[50];
string inventory; // is it possible to acces inventry from another file example: cout << roomOne::inventory;

roomOne::roomOne()
{
	cout << "" << endl;
	//main loop
	while (true)
	{
		cout << "\nYou are in a dark room with a big wooden door blocking your way.\n>> ";
		cin >> userInput;
		cin.ignore();
		
		if (!strcmp(userInput, "quit"))
		{
			system("cls");
			cout << "Quitting" << endl;
			cin.ignore();
			break;
		}

		if (!strcmp(userInput, "search" /* and "search room"*/))
		{
			system("cls");
			cout << "As you search through the room, you come across a small dark box laying on the floor." << endl;
			cin.ignore();
			continue;
		}
		
			else if (!strcmp(userInput, "search box"))// <---- two words wont work? 
			{
				system("cls");
				cout << "As you search through the box, and find an old metal key.\n";
				cout << "Key acquired" << endl;
				inventory = "key"; // <-- add key to inventory? 
				cin.ignore();
				system("cls");
				continue;
			}

	}
}



i appreciate all the help and tips i can get.
again sorry for the bad syntax and messy program.
Topic archived. No new replies allowed.