i think i had got it.it works
here is the code
#include
#include
int main()
{
//declaraction variable
//----------------------------
const size=100; //size of string
char string[size],temp[size][32];
char *tokenPtr;
int i=0;
cout<<"input string\n";
cin.getline(string,size);//read line of string
/*function char *strtok(char *s1,const char *s2) breaks s1 into token(word)
separated by character in s2
*/
tokenPtr =strtok(string," ");//pointer to first token
while (tokenPtr != NULL)
{
strcpy(temp[i],tokenPtr);//save the token to array
i++;
tokenPtr=strtok(NULL," ");
}
for(int j=0;j>b;
if (b==0)
{return 0;}
}
i try to input string like--> here i go
then output show as below
temp[0]=here
temp[1]=i
temp[3]=go
let me know if there a simple or other way to get the program run..
thank you