I want to know if converting string to int by using stoi to make it work with switch is not effecting the behavior of a program.
I am using string because I am validating user input by using asci table for this >= 48 && <= 57 method but not includes in this code to make it short.
The code:
do
{
cout << "Choice: ";
string userChoice;
cin >> userChoice;
isValid = validNum(userChoice);
if(isValid)
{
int intUserchoice = stoi (userChoice);
switch(intUserchoice)
{
case 1:
ServerStart();
}
}
}while (!isValid);