Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<conio.h>
- #include<stdio.h>
- #include<string.h>
- #include<stdlib.h>
- int coutword(char* s[],char chuoi[], char * temp){
- int nword=0;
- char* sep=" ;:,./\t\n";
- strcpy(temp,chuoi);
- char* word=strtok(temp,sep);
- while(word!=NULL){
- s[nword] = word;
- nword++;
- word=strtok(NULL,sep);
- }
- return nword;
- }
- int main(){
- char *s [100];
- for ( int i = 0 ; i < 100; i++)
- {
- *s = new char[100];
- }
- char chuoi[]="Ton That Anh";
- char* temp=new char[strlen(chuoi)+1];
- int count=coutword(s,chuoi,temp);
- for(int i=0;i<count;i++){
- printf("%s\t",s[i]);
- }
- getch();
- delete []s;
- delete []temp;
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement