Skip to main content
fix language imprecision
Source Link
Kai Burghardt
  • 1.1k
  • 1
  • 6
  • 13

Pascal, 158 B

The implementation‑defined set of char values must correspond to ASCII and the ordinal value of the built‑inimplementation‑defined constant maxChar must be greater than or equal to 255.

program P(input,output);var C:char;A:0‥255;begin
A≔0;while not EOF do begin
read(C);if C='−' then write(chr(A));A≔(A+ord(C='+')−ord(C='−'))mod 256 end end.

−3 B: If you have a processor supporting “Extended Pascal” as defined by ISO standard 10206, you may write a zero‑width string:

program P(input,output);var C:char;A:0‥255;begin
A≔0;while not EOF do begin
read(C);write(chr(A):ord(C='−'));A≔(A+ord(C='+')−ord(C='−'))mod 256 end end.

Users of the FreePascal Compiler need to insert a {$modeSwitch ISOMod+} compiler directive. This ensures an ISO‑compliant definition of the mod operator, in particular in case of negative dividends the result is still non‑negative (Euclidean‑like definition of mod).

Pascal, 158 B

The implementation‑defined set of char values must correspond to ASCII and the value of the built‑in constant maxChar must be greater than or equal to 255.

program P(input,output);var C:char;A:0‥255;begin
A≔0;while not EOF do begin
read(C);if C='−' then write(chr(A));A≔(A+ord(C='+')−ord(C='−'))mod 256 end end.

−3 B: If you have a processor supporting “Extended Pascal” as defined by ISO standard 10206, you may write a zero‑width string:

program P(input,output);var C:char;A:0‥255;begin
A≔0;while not EOF do begin
read(C);write(chr(A):ord(C='−'));A≔(A+ord(C='+')−ord(C='−'))mod 256 end end.

Users of the FreePascal Compiler need to insert a {$modeSwitch ISOMod+} compiler directive. This ensures an ISO‑compliant definition of the mod operator, in particular in case of negative dividends the result is still non‑negative (Euclidean‑like definition of mod).

Pascal, 158 B

The implementation‑defined set of char values must correspond to ASCII and the ordinal value of the implementation‑defined constant maxChar must be greater than or equal to 255.

program P(input,output);var C:char;A:0‥255;begin
A≔0;while not EOF do begin
read(C);if C='−' then write(chr(A));A≔(A+ord(C='+')−ord(C='−'))mod 256 end end.

−3 B: If you have a processor supporting “Extended Pascal” as defined by ISO standard 10206, you may write a zero‑width string:

program P(input,output);var C:char;A:0‥255;begin
A≔0;while not EOF do begin
read(C);write(chr(A):ord(C='−'));A≔(A+ord(C='+')−ord(C='−'))mod 256 end end.

Users of the FreePascal Compiler need to insert a {$modeSwitch ISOMod+} compiler directive. This ensures an ISO‑compliant definition of the mod operator, in particular in case of negative dividends the result is still non‑negative (Euclidean‑like definition of mod).

edit summary
Source Link
Kai Burghardt
  • 1.1k
  • 1
  • 6
  • 13

Pascal, 158 B

The implementation‑defined set of char values must correspond to ASCII and the value of the built‑in constant maxChar must be greater than or equal to 255.

program P(input,output);var C:char;A:0‥255;begin
A≔0;while not EOF do begin
read(C);if C='−' then write(chr(A));A≔(A+ord(C='+')−ord(C='−'))mod 256 end end.

−3 B: If you have a processor supporting “Extended Pascal” as defined by ISO standard 10206, you may write a zero‑width string:

program P(input,output);var C:char;A:0‥255;begin
A≔0;while not EOF do begin
read(C);write(chr(A):ord(C='−'));A≔(A+ord(C='+')−ord(C='−'))mod 256 end end.

Users of the FreePascal Compiler need to insert a {$modeSwitch ISOMod+} compiler directive. This ensures an ISO‑compliant definition of the mod operator, in particular in case of negative dividends the result is still positivenon‑negative (Euclidean‑like definition of mod).

Pascal, 158 B

The implementation‑defined set of char values must correspond to ASCII and the value of the built‑in constant maxChar must be greater than or equal to 255.

program P(input,output);var C:char;A:0‥255;begin
A≔0;while not EOF do begin
read(C);if C='−' then write(chr(A));A≔(A+ord(C='+')−ord(C='−'))mod 256 end end.

−3 B: If you have a processor supporting “Extended Pascal” as defined by ISO standard 10206, you may write a zero‑width string:

program P(input,output);var C:char;A:0‥255;begin
A≔0;while not EOF do begin
read(C);write(chr(A):ord(C='−'));A≔(A+ord(C='+')−ord(C='−'))mod 256 end end.

Users of the FreePascal Compiler need to insert a {$modeSwitch ISOMod+} compiler directive. This ensures an ISO‑compliant definition of the mod operator, in particular in case of negative dividends the result is still positive (Euclidean‑like definition of mod).

Pascal, 158 B

The implementation‑defined set of char values must correspond to ASCII and the value of the built‑in constant maxChar must be greater than or equal to 255.

program P(input,output);var C:char;A:0‥255;begin
A≔0;while not EOF do begin
read(C);if C='−' then write(chr(A));A≔(A+ord(C='+')−ord(C='−'))mod 256 end end.

−3 B: If you have a processor supporting “Extended Pascal” as defined by ISO standard 10206, you may write a zero‑width string:

program P(input,output);var C:char;A:0‥255;begin
A≔0;while not EOF do begin
read(C);write(chr(A):ord(C='−'));A≔(A+ord(C='+')−ord(C='−'))mod 256 end end.

Users of the FreePascal Compiler need to insert a {$modeSwitch ISOMod+} compiler directive. This ensures an ISO‑compliant definition of the mod operator, in particular in case of negative dividends the result is still non‑negative (Euclidean‑like definition of mod).

insert note regarding FreePascal Compiler deviating understanding of the mod operator
Source Link
Kai Burghardt
  • 1.1k
  • 1
  • 6
  • 13

Pascal, 158 B

The implementation‑defined set of char values must correspond to ASCII and the value of the built‑in constant maxChar must be greater than or equal to 255.

program P(input,output);var C:char;A:0‥255;begin
A≔0;while not EOF do begin
read(C);if C='−' then write(chr(A));A≔(A+ord(C='+')−ord(C='−'))mod 256 end end.

−3 B: If you have a processor supporting “Extended Pascal” as defined by ISO standard 10206, you may write a zero‑width string:

program P(input,output);var C:char;A:0‥255;begin
A≔0;while not EOF do begin
read(C);write(chr(A):ord(C='−'));A≔(A+ord(C='+')−ord(C='−'))mod 256 end end.

Users of the FreePascal Compiler need to insert a {$modeSwitch ISOMod+} compiler directive. This ensures an ISO‑compliant definition of the mod operator, in particular in case of negative dividends the result is still positive (Euclidean‑like definition of mod).

Pascal, 158 B

The implementation‑defined set of char values must correspond to ASCII and the value of the built‑in constant maxChar must be greater than or equal to 255.

program P(input,output);var C:char;A:0‥255;begin
A≔0;while not EOF do begin
read(C);if C='−' then write(chr(A));A≔(A+ord(C='+')−ord(C='−'))mod 256 end end.

−3 B: If you have a processor supporting “Extended Pascal” as defined by ISO standard 10206, you may write a zero‑width string:

program P(input,output);var C:char;A:0‥255;begin
A≔0;while not EOF do begin
read(C);write(chr(A):ord(C='−'));A≔(A+ord(C='+')−ord(C='−'))mod 256 end end.

Pascal, 158 B

The implementation‑defined set of char values must correspond to ASCII and the value of the built‑in constant maxChar must be greater than or equal to 255.

program P(input,output);var C:char;A:0‥255;begin
A≔0;while not EOF do begin
read(C);if C='−' then write(chr(A));A≔(A+ord(C='+')−ord(C='−'))mod 256 end end.

−3 B: If you have a processor supporting “Extended Pascal” as defined by ISO standard 10206, you may write a zero‑width string:

program P(input,output);var C:char;A:0‥255;begin
A≔0;while not EOF do begin
read(C);write(chr(A):ord(C='−'));A≔(A+ord(C='+')−ord(C='−'))mod 256 end end.

Users of the FreePascal Compiler need to insert a {$modeSwitch ISOMod+} compiler directive. This ensures an ISO‑compliant definition of the mod operator, in particular in case of negative dividends the result is still positive (Euclidean‑like definition of mod).

Source Link
Kai Burghardt
  • 1.1k
  • 1
  • 6
  • 13
Loading