且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

我收到一个错误:非法表达

更新时间:2023-02-20 11:17:32

代码充满错误,永远无法编译.

The code is full of errors and would never compile.

  1. 您使用 idnum 和 payment 作为数组,但您已将其声明为整数!如果您需要数组,请改用 IDNUMARR 和 PAYMENTARR.
  2. 在第 9 行和第 10 行中,您声明了全局变量 IDNUMARR PAYMENTARR,但在过程 DeclareandInitialiseArrays 中又将其声明为局部变量
  3. 几乎所有的 if 语句都是无效的

  1. You use idnum and payment as array but you've declared it as integer! If you need the array, use IDNUMARR and PAYMENTARR instead.
  2. In line 9 and 10 you declare the global var IDNUMARR PAYMENTARR but you declare it again as a local var in the procedure DeclareandInitialiseArrays
  3. Almost all if-statements are invalid

if(payment[j]=1620 and payment[j]=1980) then

if(payment[j]=1620 and payment[j]=1980) then

and"运算符总是首先被评估,这会导致逻辑比较1620 and payment[j]"(这不是一个有效的语法).

The "and" operator is evaluated always first which results in the logical comparison "1620 and payment[j]" (which is not a valid syntax).

你必须像这样把每个比较都放在括号里:

You have to put every comparison into brackets like this:

if(payment[j]=1620) and (payment[j]=1980) then

4.设置 j:=j+1;你究竟期望会发生什么??我想你只是想增加 j

4. set j:=j+1; What exactly do you expect should happen?? I think you just want increase j

j:=j+1;

  1. 所有程序都必须以;结尾而不是.
  2. 最后的开始结束".缺少执行所有程序的位置.

可能还有很多其他...

And probably many others...