ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Common Board

Help to find out / Помогите разобраться пожалуйста
Posted by SKYDOS 28 Jul 2009 01:52
How to read data with all new lines chars in this task http://acm.timus.ru/problem.aspx?space=1&num=1027 ?

Как можно прочитать данные в этом задании http://acm.timus.ru/problem.aspx?space=1&num=1027 со всеми переходами на новые строки?

Thanks to all!
Спасибо всем.
Re: Help to find out / Помогите разобраться пожалуйста
Posted by Sergey Lazarev (MSU Tashkent) 28 Jul 2009 02:04
char c = getchar();

Or I don't understand you?
Re: Help to find out / Помогите разобраться пожалуйста
Posted by SKYDOS 28 Jul 2009 04:11
Sergey Lazarev (MSU Tashkent) wrote 28 July 2009 02:04
char c = getchar();

Or I don't understand you?

no, not using getchar()

I think something like this:

while (!eof(f)) {
   getline (cin, str);
}

but I am not sure...
Re: Help to find out / Помогите разобраться пожалуйста
Posted by Loky_Yuri [USTU Frogs] 28 Jul 2009 10:58
Try this

while (getline(cin, s, '\n'))
{
}

It works fine :)
Re: Help to find out / Помогите разобраться пожалуйста
Posted by SKYDOS 28 Jul 2009 11:52
thanks a lot!
спасибо большое!
Loky_Yuri [USTU Frogs] wrote 28 July 2009 10:58
Try this

while (getline(cin, s, '\n'))
{
}

It works fine :)