hey guys i want to slpit a sentence into words but the pogram i have written gives only the first word...can u help me plz.....
#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<dos.h>
#include<stdio.h>
void main()
{
clrscr();
char text[100];
int i=0;
clrscr();
cout<<"enter the sentence";
cin.getline(text,100);
while(i<strlen(text))
{
char text1[]=" ";
int m=0;
while(text[i]!=' ')
{
text1[m]=text[i];
m++ ;
i++;
}
i++;
cout<<"\n"<<text1;
}
getch();
}
if the input is
hello world
the output i want is
hello
world
but get only hello
thanks in advance