A question on the number of lines

Write here if you have problems with your Pascal source code

Moderator: Board moderators

Post Reply
ggggqqqqihc
New poster
Posts: 12
Joined: Sun Dec 07, 2003 10:45 am

A question on the number of lines

Post by ggggqqqqihc »

For example
Input:
Each line has two integral numbers, and there are some lines, but I don't know the number of lines. When the program has read the last line, I want it to stop. How can I do that?
I'm a beginner. Thanks.
sohel
Guru
Posts: 856
Joined: Thu Jan 30, 2003 5:50 am
Location: New York

Post by sohel »

in C,
you read until EOF, <end of file>
ggggqqqqihc
New poster
Posts: 12
Joined: Sun Dec 07, 2003 10:45 am

Post by ggggqqqqihc »

Or simply stated. When I have inputted all the numbers, press ENTER twice, the program will stop. How can I do?
sohel
Guru
Posts: 856
Joined: Thu Jan 30, 2003 5:50 am
Location: New York

Post by sohel »

Read the input as string and if the lenght of it is zero it indicates the end of input.
ggggqqqqihc
New poster
Posts: 12
Joined: Sun Dec 07, 2003 10:45 am

Post by ggggqqqqihc »

Good idea. Thanks. :lol:
Post Reply

Return to “Pascal”