Hey guyy , using getline allows us to read a file line by line. but is it possible to use getline to read individual words in a line? For example.
Test.txt
My name is John.
Using getline will read the entire line...
int main (){
string templine;
ifstream myfile("test.txt");
getline(myfile , templine);
}
But is it possible to use getline and assigning each word to a string so it can be used later on? or perhaps using cin...
int main (){
string templine;
ifstream myfile("data.txt");
string r , t , b , c , d ;
myfile >> r >> t >> b >> c ;
}
is using cin the only way to assign each word or is there another way?