User forums > General (but related to Code::Blocks)

Character/String contains a letter/number

(1/1)

wonopon:
Is there something that can check if a string or character variable contains a letter?
For example :


--- Code: ---char x;
cout << "Type a word : ";
cin >> x;
if ( ) { // if x has the letter a in it then : //
cout << "Your word contains the letter a in it!" << endl;
}

--- End code ---

Jenna:
Not related to C::B in any way and therefore violating our forum rules.

Topic locked !

Navigation

[0] Message Index

Go to full version