fork download
  1. #include <iostream>
  2. #include <string.h>
  3. using namespace std;
  4. // Function to remove vowels from a string
  5. string RemoveSpaces(string str)
  6. {
  7. for (int i = 0; i < str.length(); i++)
  8. {
  9. if(str[i] == ' ')
  10. str[i] = '\0';
  11.  
  12. }
  13. return str;
  14. }
  15. int main()
  16. {
  17. string str = "take u forward";
  18. cout <<"String after removing the spaces \n" <<RemoveSpaces(str) << endl;
  19. return 0;
  20. }
Success #stdin #stdout 0.01s 5280KB
stdin
Standard input is empty
stdout
String after removing the spaces 
takeuforward