Hello,
I have googled but this seems to be a print solution.
I was looking for input validation that the string only contains numbers.
Roelof
Edit :
can this be a good solution:
Code:
int myNumber = 0;
while (true) {
cout << "Please enter a valid number: ";
getline(cin, input);
// This code converts from string to number safely.
stringstream myStream(input);
if (myStream >> myNumber)
break;
cout << "Invalid number, please try again" << endl;
}
cout << "You entered: " << myNumber << endl << endl;
can someone tell me what mystream >> mynumber means ?