#Not printing input

5 messages · Page 1 of 1 (latest)

frail cairnBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.

deep basin
#

!format

frail cairnBOT
#
#include <iostream>

using namespace std;

int main() {
  int input;
  while (true) {
    cout << "Player 1:  " << endl
         << "Where do you want to put your money-ball rack? Enter 1-5: "
         << endl;
    cin >> input;
    if (input < 1 || input > 5) {
      cout << "Invalid input, try again" << endl;
    } else {
      break;
    }
  }
  return input;
  cout << input << endl;
}
mitch
deep basin
#

!solved

frail cairnBOT
#

Thank you and let us know if you have any more questions!

This thread is now set to auto-hide after an hour of inactivity