41 lines
898 B
Plaintext
41 lines
898 B
Plaintext
string 0; \use zero-terminated strings
|
|
def LF=$0A, EOF=$1A;
|
|
int Val, Char;
|
|
char Str(80);
|
|
|
|
proc InField;
|
|
int I;
|
|
[I:= 0; Val:= 0;
|
|
loop [Char:= ChIn(1);
|
|
if Char=^, or Char=LF or Char=EOF then quit;
|
|
Str(I):= Char;
|
|
I:= I+1;
|
|
if Char>=^0 and Char<=^9 then
|
|
Val:= Val*10 + Char - ^0;
|
|
];
|
|
Str(I):= 0;
|
|
];
|
|
|
|
int Sum;
|
|
[loop [InField;
|
|
Text(0, Str);
|
|
if Char = LF then quit;
|
|
ChOut(0, ^,);
|
|
];
|
|
Text(0, ",SUM");
|
|
CrLf(0);
|
|
loop [Sum:= 0;
|
|
loop [InField;
|
|
if Char = EOF then return;
|
|
if rem(Val/5)=0 then Val:= Val*20;
|
|
IntOut(0, Val);
|
|
Sum:= Sum + Val;
|
|
if Char = LF then quit;
|
|
ChOut(0, ^,);
|
|
];
|
|
Text(0, ",");
|
|
IntOut(0, Sum);
|
|
CrLf(0);
|
|
];
|
|
]
|