So i have this task to so search the text file for lines with more than 1 word.
and i cant figure out how to search my string array like that.
any help? i've searched the web, but i could not find how do that with a string array.
Text file :
@MisterWhite you should use std::getline to read the entire line and then check whether there are any spaces in the resultant string. This can be done by iterating through the characters of the string and checking for space using the isspace() function.
No it is not checking to see if the line is a space, it is checking to see if the current character at position j within the line is a space. The outer loop is for the lines and the inner loop for the characters in each line.
..0123456 <--- j
0 Peru
1 Los Angeles
2 El Paso
3 Boston
4 Mesa
The i value is indexing each line and the j value is indexing each character in a line