kolioi

23. Comma Replacement C++

Dec 2nd, 2018
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.29 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. void ReplaceComma(std::string&);
  5.  
  6. int main()
  7. {
  8.  
  9.     std::string s;
  10.     std::cin >> s;
  11.  
  12.     ReplaceComma(s);
  13.  
  14.     std::cout << s << std::endl;
  15.  
  16.     return 0;
  17. }
  18.  
  19. void ReplaceComma(std::string& s)
  20. {
  21.     for (char& ch : s)
  22.         if (ch == ',')
  23.             ch = ' ';
  24. }
Advertisement
Add Comment
Please, Sign In to add comment