-
April 2nd, 2009, 01:56 AM
#1
Searching C++ strings?
So I'm trying to write a Hangman game and I'm a bit stuck as to how to go about doing it.
Basically, I'll have Player 1 enter a string and player 2 will then try to guess characters within that string.
Is there a function that will search a string for specific characters?
Thanks
-
April 2nd, 2009, 02:09 AM
#2
Re: Searching C++ strings?
Surprisingly, this function is called .find() (-:
Have this site in mind before asking such questions:
http://www.cppreference.com
In this very case you may pay attention to the fact you search for more than one occurrence of the character in the string. Probably standard algorithms like for_each or transform will do the job.
-
April 2nd, 2009, 10:46 AM
#3
Re: Searching C++ strings?
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|