fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. // void Reverseword(char *texts,int start,int end)
  5. // {
  6. // int length;
  7. // length = strlen(texts);
  8.  
  9.  
  10. // for(start = end = 0; end<length; end++)
  11. // {
  12. // if(texts[end] != ' ')
  13. // {
  14. // start = end;
  15. // while(texts[end] != ' ' && end < length)
  16. // end++;
  17. // end--;
  18. // //Reversing(texts, start, end);
  19. // }
  20. // }
  21.  
  22. // }
  23.  
  24. void Reversing(char texts[], int start,int end)
  25. {
  26. for(char temp;start<end;start++,end--)
  27. {
  28. temp = texts[end];
  29. cout<<temp<<endl;
  30. texts[end] = texts[start];
  31. texts[start] = temp;
  32. }
  33. }
  34. int main()
  35. {
  36. char str[100] = " my name is nishu";
  37. // Reverseword(str);
  38. int start = 0;
  39. int length = strlen(str);
  40. int end = length-1;
  41. // Reverseword(str,start,end);
  42. Reversing(str,start,end);
  43. cout<<str;
  44. }
Success #stdin #stdout 0s 5376KB
stdin
Standard input is empty
stdout
u
h
s
i
n
 
s
i
uhsin si eman ym