我有一个编程任务,我的老师给了我这个例子,但是当我尝试运行它时,它说
致命:语法错误,;预期但VAR在第14/1行找到。
有什么方法可以解决这个问题吗?
以下是代码:
答案 0 :(得分:3)
Pascal和英语中初学者的错误消息细分:
错误信息说明了许多事情:
`Fatal:` means that the error prevents further processing/running
`Syntax error` means that the code is incorrectly formulated
`; expected` means that the code parser expected to find a semicolon
`but VAR found` instead of the semicolon, the word VAR was found
`on line 14/1` means that the error was detected on line 14 in character position 1
查看代码(带行号)
11.const
12. vcharge=1000;
13. interrate=0.08
14.var
15. name,ward:string;
很明显,缺少的分号应该在第13行的末尾(实际上它在语法上是正确的,如果放在第14行的开头,在'var'之前,但这不是我们写Pascal的方式)。