You can read character by character until reading an end-of-line character.
This code in Pascal:
[pascal]var
f:Text;
c:Char;
while not eoln(f) do
begin
Read(f, c);
{do something with c}
end;
Readln(f);{advance to the next line}
[/pascal]
might become
[cpp]ifstream inp;
char c;
while ((c = inp.get ...
Search found 14 matches
- Fri Apr 16, 2004 9:08 pm
- Forum: C++
- Topic: How do u check for eoln in C++?
- Replies: 3
- Views: 3290
- Mon Feb 10, 2003 6:18 pm
- Forum: Volume 2 (200-299)
- Topic: 273 - Jack Straws
- Replies: 19
- Views: 4992
Incorrect problem description (probem 273)
I think that the description of problem 273 is wrong.
It states that 1 < n < 13, but when I sent my solution, I received Runtime Error.
When I enlarged my arrays to hold more than 12 sticks, I got Wrong Answer.
Then I submitted a solution that would go into an endless loop if n is not between 1 and ...
It states that 1 < n < 13, but when I sent my solution, I received Runtime Error.
When I enlarged my arrays to hold more than 12 sticks, I got Wrong Answer.
Then I submitted a solution that would go into an endless loop if n is not between 1 and ...
- Sun Feb 02, 2003 8:18 pm
- Forum: Pascal
- Topic: 64 bit integer in pascal
- Replies: 2
- Views: 5200
- Thu Jan 23, 2003 8:45 pm
- Forum: Algorithms
- Topic: Miller-Rabin test
- Replies: 2
- Views: 3087
- Tue Jan 14, 2003 9:02 pm
- Forum: Algorithms
- Topic: How to detect an arithmetic overflow
- Replies: 6
- Views: 4524
The right way to write detect_addition_overflow() is the following (see Leendert Ammeraal, Algorithms and Data Structures in C++, John Wiley & Sons, ISBN 0-471-96355-0):
[cpp]inline int detect_addition_overflow(int a, int b, int overflow_value) {
int result = a + b;
if (result >= a) return result ...
[cpp]inline int detect_addition_overflow(int a, int b, int overflow_value) {
int result = a + b;
if (result >= a) return result ...
- Fri Jan 03, 2003 8:05 pm
- Forum: C
- Topic: linked lists
- Replies: 7
- Views: 3935
- Fri Jan 03, 2003 8:01 pm
- Forum: Volume 1 (100-199)
- Topic: 191 - Intersection
- Replies: 103
- Views: 33472
You have submitting problem. I guess you are using e-mail submission. Do you see the long one-line comment containing the word full? SMTP servers (the servers delivering electronic mail) and many e-mail clients love wrapping long lines, so what the judge receives is:
// Check if both lines segments ...
// Check if both lines segments ...
- Fri Jan 03, 2003 7:45 pm
- Forum: C
- Topic: linked lists
- Replies: 7
- Views: 3935
- Sun Dec 08, 2002 4:56 pm
- Forum: Other words
- Topic: Change user name on board?
- Replies: 1
- Views: 2015
- Wed Dec 04, 2002 8:28 am
- Forum: Algorithms
- Topic: Minimum Cost Transport Algorithm
- Replies: 3
- Views: 3115
- Thu Nov 28, 2002 10:29 pm
- Forum: C++
- Topic: Old G++ version unacceptable
- Replies: 4
- Views: 3388
- Wed Nov 20, 2002 8:44 am
- Forum: C++
- Topic: Grow Array Size
- Replies: 13
- Views: 5907
- Sun Nov 17, 2002 2:02 pm
- Forum: C++
- Topic: Using Long Long s
- Replies: 1
- Views: 1936
- Sun Nov 17, 2002 1:53 pm
- Forum: C++
- Topic: Something's terribly wrong with long long ints
- Replies: 1
- Views: 1868