pascal的超级简单的问题

[复制链接]
查看11 | 回复1 | 2011-3-5 03:16:06 | 显示全部楼层 |阅读模式
这个语句
program aaa;
var a : integer;
begin
if a5 then writeln(a 1)
else writeln(\'请输入大于5的数字\');
readln;
end.
这个随便写的算a 1的程序,要求a必须大于五才能计算,但是如果用户输入了一个数字小于五按回车 出现提示后再按回车就退出了啊 ,我想按了回车 又回到第一步readln(a);这句该怎么办,也就是说不顺序执行文件,而可以跳转》
回复

使用道具 举报

千问 | 2011-3-5 03:16:06 | 显示全部楼层
<pre id=\"best-answer-content\" class=\"reply-text mb10\">这个程序本身还没有读入a呢。如果你想继续读的话那就加个跳转语句【GOTO】。
编写后:
Program aaa;
Label
1;
Var
a:integer;
Begin
1:
Readln(a);
If a5 then

Writeln(a 1)
Else
Begin

Writeln(\'a must 5!\');

Goto 1;
End;
End.
望采纳。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行