count controlled while loop

i need to have one string of line from the input file on one line.
(ex:
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.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
  lineNumber = 1;




while (lineNumber <= 7 )
{
	inFile >> line;

	cout << "Line #" << setw(10)<< lineNumber;
	
	

	lineNumber++;
}
try using cin.getline(), like this:
std::cin.getline(line , sizeof(line));
closed account (Dy7SLyTq)
i would use getline(std::string, ifstream)
i fixed it i was using infile >> instead of getline(). thankjs
Topic archived. No new replies allowed.