Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- char s[301], *p;///pointer la caractere=adresa la care se gaseste sirul s
- char sep[]=" ,.!:?";
- char cuv[101][301];///vector de cuvinte
- int n;
- int main()
- {
- ///strtok(sir, sep)
- ///impartirea in cuvinte
- cin.getline(s,300);
- p=strtok(s,sep);///inlocuieste toti separatori cu NULL
- while(p!=NULL)
- {
- ///cout<<p<<'\n';
- strcpy(cuv[++n],p);
- p=strtok(NULL,sep);///NULL sau 0
- }
- for(int i=1;i<=n;i++)
- cout<<cuv[i]<<'\n';
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement