Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ///7. Sa se determine de cate ori se gaseste un cuvant intr-un text.
- #include<iostream>
- #include<string.h>
- #include<cstdio>
- using namespace std;
- int main()
- {
- char x[100];
- char y[100];
- cout<<"Text : ";gets(x);
- cout<<"Cuvant : ";cin>>y;
- char * pch;
- int cnt=0;
- pch = strtok (x," ,.-");
- while (pch != NULL)
- {
- if(!strcmp(pch,y)) cnt++;
- printf ("%s\n",pch);
- pch = strtok (NULL, " ,.-");
- }
- cout<<endl<<"Cuvinte : "<<cnt;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement