Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- int main()
- {
- char a[100],cuv[100][20],*p,separator[]=" ,;:";
- cout<<"Dati sirul:";
- cin.get(a,100);
- p=a;
- p=strtok(p,separator);
- int nr=0;
- while(p)
- strcpy(cuv[++nr],p),p=strtok(NULL,separator);
- cout<<"Sunt "<<nr<<" cuvinte:"<<'\n';
- for(int i=1;i<=nr;++i)
- cout<<cuv[i]<<'\n';
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement