count controlled while loop
i need to have one string of line from the input file on one line.
line 1. this is a cool day
line 2. this day can get cooler
line 3. this day is cold
my problem is i have this.
line 1. this
line 2. is
line 3. a
line 4. cool
see how it is only doing the one string line with one word.
lineNumber = 1;
while (lineNumber <= 7 )
inFile >> line;
cout << "Line #" << setw(10)<< lineNumber;
try using cin.getline(), like this:
std::cin.getline(line , sizeof(line));
i would use getline(std::string, ifstream)
i fixed it i was using infile >> instead of getline(). thankjs
Topic archived. No new replies allowed.