I am trying to split the sentence into words by checking the characters from the string one by one.
#include <iostream>
using namespace std;
int main()
{
string a;
getline(cin,a);
string word = "";
for(int i=0;i=a.size();i++)
{
if(a[i]==" ") //error iso here
{
cout<<word<<endl;
word="";
}
else
{
word+=a[i];
}
cout<<word<<endl;
}
}