Advertisement
fferum

Untitled

May 29th, 2020
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. char** getWords(char* line, size_t amount){
  2.     char** words = new char*[amount]();
  3.     int index_one = -1;
  4.     int counter_words = 1;
  5.     for (size_t i = 0; i < amount; i++)
  6.     {
  7.         if (line[i] == ' '|| line[i] == '.')
  8.         {
  9.             int index_two = i-1;
  10.             for (size_t i = 0; i <counter_words ; i++) {
  11.                 for (size_t j = index_one + 1; j < index_two - 1; j++)
  12.                 {
  13.                     words[i][j] = line[j];
  14.                 }
  15.                 counter_words++;
  16.             }
  17.             int index_one = i+1;
  18.  
  19.         }
  20.     }
  21.     return words;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement