fork(2) download
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4. char s[20000], *p, a[5000], separator[] = " ";
  5. int k = 0, i;
  6. void separare();
  7. void afisare();
  8. int main()
  9. {
  10. cout << "Sirul de nr:"; cin.get(s, 100, '\n');
  11. separare();
  12. afisare();
  13. system("pause");
  14. return 0;
  15. }
  16. void separare()
  17. {
  18. p = strtok(s, separator);
  19. while (p)
  20. {
  21. strcpy(a[k], p);
  22. k++;
  23. p = strtok(NULL, separator);
  24. }
  25. }
  26. void afisare()
  27. {
  28. int i;
  29. for (i = 0; i < k; i++)
  30. cout << a[i] << " ";
  31. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘void separare()’:
prog.cpp:18:25: error: ‘strtok’ was not declared in this scope
  p = strtok(s, separator);
                         ^
prog.cpp:21:17: error: ‘strcpy’ was not declared in this scope
   strcpy(a[k], p);
                 ^
stdout
Standard output is empty