【发布时间】:2015-02-12 22:18:41
【问题描述】:
我正在读取标准输入(一个文本文件并使用这样排列的数据进行计算:
2 --This states the amount of following sets of info
150 -- this is the first set of data
250 -- this is the second set of data
0 -- this is supposed to tell my program that this is the end of the two sets but
keep looping because there might be multiple sets in here, seperated by "0"'s.
我的 ADA 计划的基本大纲:
procedure test is
begin
while not end_of_file loop
......//my whole program executes
end loop;
end test;
我想知道如何告诉我的程序继续循环,直到没有要读取的内容,但要记住零是分开数据集的,如果每个“0”之后还有更多数据,则继续循环。
【问题讨论】:
-
如果没有更多的输入,0 的位置会出现什么?
-
最后一组数据后不用加“0”
-
请向我们展示您是如何读取单个数据集的(带有完整的、可编译的示例)。