I'm new to c++ but i just try to make a simple text based game and the cin command wasnt working for the second time i was using it here is a chuck of my code.
using namespace std;
int sticks = 0;
int health = 100;//players health
int rocks = 0;
int pickaxehealth = 50;
int swordhealth = 50;
cout << "Welcome to Classic Text 1.0." << endl;
cout << "____________________________" << endl;
cout << " Enter your name: ";
cin >> name;
cout << "You wake up in the middle of the night, In a" << endl <<
"clearing of a forest. There is a path to the" << endl <<
"left and the right. Which way do you want to go" << endl;
cout << "_______________________________________________" << endl;
cout << " Type 1 to go right. Type 2 to go left"<< endl;
cout << "Enter which way you want to go: " << endl;
cin >> direction1;
You send a stream (std::cin) to a char pointer (for one or more chars but pointer) Stream need a buffer.
Declare name as: char name. Now if std::cin data are less than 32 std::cin frees its space and send new data.
In your program std::cin access to direction but still have char data because name holds only the 1st byte.