Frank Schönmann: C++ - Problem *Hilfe*

Beitrag lesen

hi!

int ModifyString(char *string)
{ while (*string)
      *string++ = AnotherChar;
   return (0);
}

In C++ macht man das natuerlich so:

  
#include <string>  
  
class replace_char : public std::unary_function<char, void> {  
  public:  
    void operator()(char &c) {  
      ++c;  
    }  
};  
  
int main() {  
    std::string s = "Hello World!";  
    std::for_each(s.begin(), s.end(), replace_char());  
}  

:D

bye, Frank!

--
Never argue with an idiot. He will lower you to his level and then
beat you with experience.