Needing some help with a text base game.

Morning.

I'm a completely new programmer who hopefully plans on going to college this September, so I'm trying to get a good head start with C++. I've decided the best way to learn is to create something I'm interested in. I've decided to make a text base game with user interaction and hopefully lots of different ways to play.

I've found a snippet of code about making users interact with a couple of options. The first one I'm planning on using is picking between 3 weapons, a sword, staff and bow

I have a couple of problems

1.the compiler doesn't like the cin >> choiceOne_Path;
2. I'm not sure what the system(cls) is for
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
 #include <iostream>
using namespace std;

int main()
{
	string charname;;

	cout << "welcome to Carlisle, please select players name" << endl;
	getline (cin,charname);
	
	cout << "\nwelcome to the game " << charname << endl;
	cout<<"\n-------------------Press any key to continue-------------------" << endl;
	system("pause");
	cout <<"\game text here."<< endl;

system("cls");
	int choiceOne_Path;
	cout << "which one would you like to pick up:\n";
	cout << "\n Enter 1 to pick up the sword"<< endl;
	cout << "\n Enter 2 to pick up the bow" << endl;
	cout << "\n Enter 3 to pick up the staff" << endl;
	retry:
	cout << "\n Enter your choice"
	cin >> choiceOne_Path;
	
	if(choiceOne_Path == 1)
		
		{
			cout >> "You have picked up the sword" << endl;
			
		}
	else if(choiceOne_Path == 2)
	{
			cout >> "You have picked up the bow" << endl;
				
	}
	
	else if (choiceOne_Path == 3)
	{
			cout >> "You have picked up the staff"<< endl;
	}
}
Last edited on
What's missing from the end of line 23?

systen("cls") is to clear your console screen

also...I think you are trying to use goto ?? why not use do..while instead ?
@moschops cheers for the help

@Flaze I just found a tutorial. well code snippets from a website and was just following that. Not really sure what I'm trying to do at the minute, it's just a play about.
Topic archived. No new replies allowed.