I have written a piece of code to validate a keyword, it validates and makes sure that the word is 5 letters long and it is all letters with no numbers in it. However, when I run it, the code seems to stop working at all and doesn't prompt me for the next question, I've tested it without this code and this part of the code is the problem, as it works fine without it.
The code:
cout<<name1<<", please enter the keyword (5 characters): "<<endl;
cin>>key;
for(int i = 0; i < keylength; i++){
if(isalpha(key[i]) == 1){
validnum += 1;
}
}
if(validnum == keylength && key.length() == keylength){
validated = true;
}
else{
validated = false;
}
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)