我有一个编程任务,我的老师给了我这个示例,但是当我尝试运行它时,它说
致命:语法错误,;预期但在第14/1行上发现了var。
有什么方法可以解决此问题?
这是代码:
http://pastebin.com/gp8q7gav
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行的末尾(实际上在句法上是正确的,如果在" var'一词的开头,则将其放置在第14行的开头,但这不是我们编写pascal的方式)。