Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
40
Task/CSV-data-manipulation/XPL0/csv-data-manipulation.xpl0
Normal file
40
Task/CSV-data-manipulation/XPL0/csv-data-manipulation.xpl0
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
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);
|
||||
];
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue