So,im making smth like siri but console windowed.In the beginning you enter your name in a character sequence max=100. so i want to check is he spaming or writing stupid names by checking the chars ex. PETER=WRONG NAME peter=WRONG NAME
Peter=RIGHT NAME. i have no idea how to do this.tried a lot of things but none of them works.
help pls
char name[20];
Int numberOfLetter=1;
Int dotsearcher=0;
Bool isNameWrong;
Cin>>name;
if(name[numberOfLetter]>='a' and name[numberOfLetter]<='z'{
IsNameWrong=true;
}
Else if(name[numberaofLetter]>='A' and name[numberOfLetter]<='Z'){
numberOfLetter=2;
}
For(numerOfLetter=2;numberOfLetter<20;numberOfLetter++){
for(dotSearcher=0;name[dotSearcher]='.';dotSearcher++;){
If(name[numberOfLetter]<'a' or name[numberofLetter]>'z')
IsNameWrong=TRUE;
}
}
}
if(isNaneWrong){
Cout<<endl<<"wrong"<<endl;
}
i wrote it on my tablet cus i dont have internet on my pc so ignore my mistakes
The error is :the consloe window opens but when i cin the name the console stops responding
This is a code which I put up just now. I separated it into functions for easier readability. It checks whether only the first letter of the input is capital. You still need to do some work yourself and make the program see if any other letters are also capital thus making the name invalid (I.E: PeTer). This is enough of a hint to point you in a right direction.