Advertisement
Guest User

Untitled

a guest
Sep 17th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. void Nword(char* initialString, int position)
  2. {
  3. if (position == 0)
  4. {
  5. std::cout << -1;
  6. return;
  7. }
  8. else if (position == 1)
  9. {
  10. while (*initialString != ' ')
  11. {
  12. //initialString = initialString + 1;
  13. std::cout << *initialString;
  14. if (*initialString != '\0')
  15. initialString = initialString + 1;
  16. else return;
  17. }
  18. return;
  19. }
  20. else
  21. {
  22. if (*initialString == ' ')
  23. return Nword(initialString + 1, position - 1);
  24. else
  25. {
  26. return Nword(initialString + 1, position);
  27. }
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement