Checking for proper name of the user

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
Can you present us with a sample of code seeing its problem?
As Group of Eight said, can you at least give us the code you've tried? We need a basis of what you're doing.

Also, I don't understand what you mean by "checking the chars ex."
By checking the chars i mean name[int i =1] shoud be Upercase and so on
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
bool validity(string name1){

    char word[100];
    for(int c = 0; c < name1.size(); c++){
        word[c] = name1[c];
    }
    char cap = word[0];
    if(isupper(cap)){
        cout<<"Your name is valid: " <<name1;
        return true;
    }
    else{
        cout<<"Your name is invalid: " <<name1;
        return false;
    }

}
int main()
{
    string name;
    cout<<"Enter your name: ";
    cin>>name;
    validity(name);
    return 0;
}



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.
Thanks man i was trieing so much but never got an idea for using params
Topic archived. No new replies allowed.