CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 2006
    Posts
    102

    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

  2. #2
    Join Date
    Mar 2009
    Location
    Bulgaria
    Posts
    63

    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.

  3. #3
    Join Date
    May 2006
    Posts
    102

    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
  •  





Click Here to Expand Forum to Full Width

Featured