I'm currently learning classes within C++ at university and I'm writing a small program that just allows users to type in values for a weapon and then relays it back to the user.
I have managed to write a small bit of code that allows a user to input values for a weapon, and then relays it back to the user.
So far it works fine, but when the user gets to input the examine information for the weapon, it skips past that part and continues executing the code.
gun2 weapon;
cout << "Enter a weapon name: ";
getline(cin, weapon.name);
cout << "Enter the capacity for the weapon: ";
cin >> weapon.capacity;
cout << "Enter the damage for the weapon: ";
cin >> weapon.damage;
cout << "Enter the accuracy for the weapon: ";
cin >> weapon.accuracy;
cout << "Enter the space used for the weapon: ";
cin >> weapon.spaceUsed;
cout << "Enter the examine information for the weapon: ";
/* this outprints in the console, but doesn't allow the user to input any information, which makes this blank when the information is relayed back to the user */
getline(cin, weapon.examine);
cout << "\n\n\n";
//Output data here
cout << "Weapon Name: " << weapon.name << endl;
cout << "Weapon Capacity: " << weapon.capacity << endl;
cout << "Weapon Damage: " << weapon.damage << endl;
cout << "Weapon Accuracy: " << weapon.accuracy << endl;
cout << "Weapon Space: " << weapon.spaceUsed << endl;
cout << "Weapon Examine: " << weapon.examine << endl;