I / O

Write here if you have problems with your C++ source code

Moderator: Board moderators

Post Reply
route
New poster
Posts: 39
Joined: Sat Dec 21, 2002 1:25 am

I / O

Post by route »

How to detect for eoln ?
Are there any pre-definied constants, e.g. Pi in C++ ?
Krzysztof Duleba
Guru
Posts: 584
Joined: Thu Jun 19, 2003 3:48 am
Location: Sanok, Poland
Contact:

Post by Krzysztof Duleba »

end-of-line charatcer is '\n'. If you use iostream, you can simply check the following condition:

if(cin.peek()=='\n')...
bugzpodder
Experienced poster
Posts: 147
Joined: Fri Jun 13, 2003 10:46 pm

Post by bugzpodder »

you can use 4*atan(0) for pi
Dominik Michniewski
Guru
Posts: 834
Joined: Wed May 29, 2002 4:11 pm
Location: Wroclaw, Poland
Contact:

Post by Dominik Michniewski »

1. if you want to check eoln you should be awere to check two characters: '\r' and '\n' ....
2. standard PI definitions (in many contests and in many problems at this site) is acos(-1.0) or 2.0*acos(0.0)

Best regards
DM
If you really want to get Accepted, try to think about possible, and after that - about impossible ... and you'll get, what you want ....
Born from ashes - restarting counter of problems (800+ solved problems)
Krzysztof Duleba
Guru
Posts: 584
Joined: Thu Jun 19, 2003 3:48 am
Location: Sanok, Poland
Contact:

Post by Krzysztof Duleba »

The Online Judge runs under Linux, so it has the Unix text file format. In Unix eol is a single '\n' character - line feed characters are Windows feature.
Post Reply

Return to “C++”