G
Gaijinco
I had a file named nap.in which looks like this:
4
10:00 12:00 Lectures
12:00 13:00 Lunch, like always.
13:00 15:00 Boring lectures...
15:30 17:45 Reading
4
10:00 12:00 Lectures
12:00 13:00 Lunch, just lunch.
13:00 15:00 Lectures, lectures... oh, no!
16:45 17:45 Reading (to be or not to be?)
4
10:00 12:00 Lectures, as everyday.
12:00 13:00 Lunch, again!!!
13:00 15:00 Reading (I love reading, but should I schedule it?)
1
12:00 13:00 I love lunch! Have you ever noticed it?
I'm using this to read the file and extract the data:
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
ifstream in("nap.in");
string line;
while(getline(in,line))
{
int n = atoi(line.c_str());
for(int times=1; times<=n; ++times)
{
getline(in,line);
cout << line << endl;
}
}
return 0;
}
But it is outputing this:
10:00 12:00 Lectures
12:00 13:00 Lunch, like always.
13:00 15:00 Boring lectures...
15:30 17:45 Reading
10:00 12:00 Lectures
12:00 13:00 Lunch, just lunch.
13:00 15:00 Lectures, lectures... oh, no!
16:45 17:45 Reading (to be or not to be?)
10:00 12:00 Lectures, as everyday.
12:00 13:00 Lunch, again!!!
13:00 15:00 Reading (I love reading, but should I schedule it?)
1
The BIG whitespace is actually part of the output.
What is happening?
Thanks.
4
10:00 12:00 Lectures
12:00 13:00 Lunch, like always.
13:00 15:00 Boring lectures...
15:30 17:45 Reading
4
10:00 12:00 Lectures
12:00 13:00 Lunch, just lunch.
13:00 15:00 Lectures, lectures... oh, no!
16:45 17:45 Reading (to be or not to be?)
4
10:00 12:00 Lectures, as everyday.
12:00 13:00 Lunch, again!!!
13:00 15:00 Reading (I love reading, but should I schedule it?)
1
12:00 13:00 I love lunch! Have you ever noticed it?
I'm using this to read the file and extract the data:
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
ifstream in("nap.in");
string line;
while(getline(in,line))
{
int n = atoi(line.c_str());
for(int times=1; times<=n; ++times)
{
getline(in,line);
cout << line << endl;
}
}
return 0;
}
But it is outputing this:
10:00 12:00 Lectures
12:00 13:00 Lunch, like always.
13:00 15:00 Boring lectures...
15:30 17:45 Reading
10:00 12:00 Lectures
12:00 13:00 Lunch, just lunch.
13:00 15:00 Lectures, lectures... oh, no!
16:45 17:45 Reading (to be or not to be?)
10:00 12:00 Lectures, as everyday.
12:00 13:00 Lunch, again!!!
13:00 15:00 Reading (I love reading, but should I schedule it?)
1
The BIG whitespace is actually part of the output.
What is happening?
Thanks.