Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Da se najdat site zborovi vo nekoj tekst.
- #include <iostream>
- using namespace std;
- int main()
- {
- char text[500], word[50][500];
- int m = 0, n = 0;
- cout << "Vnesi tekst: ";
- cin.getline(text, 500);
- cout << endl;
- for (int i = 0;;++i)
- {
- if (text[i] == '\0')
- {
- word[m][n] = '\0';
- break;
- }
- else if (!(text[i] == ',' || text[i] == '.' || text[i] == ';' || text[i] == ':' || text[i] == '!' || text[i] == '?'))
- {
- if (text[i] == ' ')
- {
- word[m++][n] = '\0';
- n = 0;
- }
- else
- {
- word[m][n++] = text[i];
- }
- }
- }
- for (int i = 0; i <= m; ++i) cout << word[i] << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment