帕斯卡 - 最大公约数 - 无输出

时间:2017-10-16 08:54:30

标签: pascal

提前感谢您的帮助。我必须在Pascal中开始编程,并且非常诚实地说,Java和Python并不是那么令人愉快的改变。我尝试了一个简单的程序来返回GCD,但是尽管最后读取了控制台,控制台仍然不会保持打开状态。

ERROR LOG

ERROR in multi ./src/styles.css C:/server/node_modules/bootstrap/dist/css/bootstrap.css
Module not found: Error: Can't resolve 'C:\server\node_modules\bootstrap\dist\css\bootstrap.css' in 'C:\dev\mean\ems-mean\client\node_mod
ules\@angular\cli\models\webpack-configs'
resolve 'C:\server\node_modules\bootstrap\dist\css\bootstrap.css' in 'C:\dev\mean\ems-mean\client\node_modules\@angular\cli\models\webpac
k-configs'
  using description file: C:\dev\mean\ems-mean\client\node_modules\@angular\cli\package.json (relative path: ./models/webpack-configs)
    Field 'browser' doesn't contain a valid alias configuration
  after using description file: C:\dev\mean\ems-mean\client\node_modules\@angular\cli\package.json (relative path: ./models/webpack-confi
gs)
    No description file found
    no extension`enter code here`
      Field 'browser' doesn't contain a valid alias configuration
      C:\server\node_modules\bootstrap\dist\css\bootstrap.css doesn't exist
    .ts
      Field 'browser' doesn't contain a valid alias configuration
      C:\server\node_modules\bootstrap\dist\css\bootstrap.css.ts doesn't exist
    .js
      Field 'browser' doesn't contain a valid alias configuration
      C:\server\node_modules\bootstrap\dist\css\bootstrap.css.js doesn't exist
    as directory
          C:\server\node_modules\bootstrap\dist\css\bootstrap.css doesn't exist
    [C:\server\node_modules\bootstrap\dist\css\bootstrap.css\package.json]
    [C:\server\node_modules\bootstrap\dist\css\bootstrap.css]
    [C:\server\node_modules\bootstrap\dist\css\bootstrap.css.ts]
    [C:\server\node_modules\bootstrap\dist\css\bootstrap.css.js]
    [C:\server\node_modules\bootstrap\dist\css\bootstrap.css]
     @ multi ./src/styles.css C:/server/node_modules/bootstrap/dist/css/bootstrap.css

1 个答案:

答案 0 :(得分:1)

我不知道你使用的是哪种Pascal,我在FreePascal 3.0.0 for Windows中试过这个:

program App1Learning;

var
  a, b : integer;

begin
  readln(a);
  readln(b);
  // Or, instead of the two previous lines: readln(a, b);
  while a <> b do
  begin
    if a < b then b := b - a;
    if a > b then a := a - b;
  end;
  writeln(a);
  readln;
end.

Read(),虽然它依赖于缓冲的行输入,但不等待回车,所以它会读取两个数字,但不会消耗最后的回车符,即这仍然在输入缓冲区中即可。程序计算出GCD并显示后,最终readln将立即读取仍在缓冲区中的回车符,因此控制台会在之后关闭(readln没有等待回车,因为它已经 - 或者仍然 - 在缓冲区中。

如果您使用readln(a);等,则每个数字将在其自己的行上输入,并且该函数等待回车并使用它。这意味着最终readln将无法在输入缓冲区中找到回车符,因此它将等到您按 Enter