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
#include <iostream>
usingnamespace 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;
}
elseif(choiceOne_Path == 2)
{
cout >> "You have picked up the bow" << endl;
}
elseif (choiceOne_Path == 3)
{
cout >> "You have picked up the staff"<< endl;
}
}
@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.