fork(1) download
  1. #include <iostream>
  2.  
  3. int main() {
  4.  
  5. char str[256] = "12,34,56";
  6. int count=0;
  7.  
  8. for( char* c=str; *c; c++ )
  9. {
  10. if( *c==',')
  11. {
  12. *c ='.';
  13. count++;
  14. }
  15. }
  16.  
  17. std::cout << str << "\t" << count << std::endl;
  18.  
  19. return 0;
  20. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
12.34.56	2