Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #include<iostream>
  2. #include<fstream>
  3. #include<string.h>
  4. using namespace std;
  5.  
  6. int words(char *str)
  7. {
  8. char *delimitator = strtok(str, " ");
  9. while (delimitator != NULL)
  10. {
  11. cout << delimitator << endl;
  12. delimitator = strtok(NULL, " ");
  13. }
  14. }
  15.  
  16. int main()
  17. {
  18. char *str = new char;
  19. ifstream in;
  20. in.open("test.txt");
  21. in.getline(str,256);
  22. words(str);
  23. return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement