I think you’d like to separate all of the words in this sentence, so you can’t make loop stop when it meet first blank.
#include<iostream>
using namespace std;
int main()
{
char sentence[100]={'\0'}, word[100]={' '};
cin.getline(sentence,100);
for(int i = 0; sentence[i] != '\0'; i++)
{
word[i]=sentence[i];
}
cout << word;
}
Above code may can help you.
solved How to separate words from a sentence (only using character arrays and no built-in c++ functions)? [closed]