well, this is my code:
while(!isdigit(c) || num.length() < 4){
cout << "Enter your four digit pin: ";
cin >> num;
for(i = 0;i < num.length(); i++){
c = num.at(i);
if (isdigit(c)){
pin[i] = atoi(num.substr(i, 1).c_str());
}
}
if(!isdigit(c) || num.length() < 4){
cout << "Invalid Pin." << endl;
}
}
and this should be the output:
Enter your 4 digit pin number: qwerty
Invalid pin.
Enter your 4 digit pin number: 43x1
Invalid pin.
Enter your 4 digit pin number: 432
Invalid pin.
Enter your 4 digit pin number: 4321
Select Option ([L]ist Titles, [D]isplay Item, [A]dd Item, [Q]uit):
**but instead i get this:
Enter your 4 digit pin number: 43x1
Invalid Pin.
Select Option ([L]ist Titles, [D]isplay Item, [A]dd Item, [Q]uit):
**whenever i enter "43x1" it does show "Invalid Pin" but it still displays the menu options
how can i fix this?