Data update
This commit is contained in:
parent
72eb4943cb
commit
4d5544505c
2347 changed files with 62432 additions and 16731 deletions
49
Task/Text-processing-1/XPL0/text-processing-1.xpl0
Normal file
49
Task/Text-processing-1/XPL0/text-processing-1.xpl0
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
include xpllib; \for Print
|
||||
|
||||
char File_name, C, Date(10+1), FalseDate(10+1);
|
||||
int N, I, Flag, Count, FalseCount, FalseRun, Readings;
|
||||
real Data, Line_tot, Line_avg, Total;
|
||||
|
||||
[File_name:= "readings.txt";
|
||||
FSet(FOpen(File_name, 0), ^i); OpenI(3);
|
||||
Total:= 0.; Readings:= 0; FalseCount:= 0; FalseRun:= 0;
|
||||
loop
|
||||
[for N:= 0 to 10-1 do
|
||||
[C:= ChIn(3);
|
||||
if C = LF then C:= ChIn(3);
|
||||
if C = EOF then quit;
|
||||
Date(N):= C;
|
||||
];
|
||||
Date(N):= 0;
|
||||
|
||||
Line_tot:= 0.; Count:= 0;
|
||||
for N:= 0 to 24-1 do
|
||||
[Data:= RlIn(3);
|
||||
Flag:= IntIn(3);
|
||||
if Flag > 0 then
|
||||
[Line_tot:= Line_tot + Data;
|
||||
Count:= Count + 1;
|
||||
FalseCount:= 0;
|
||||
]
|
||||
else
|
||||
[FalseCount:= FalseCount+1;
|
||||
if FalseCount > FalseRun then
|
||||
[FalseRun:= FalseCount;
|
||||
for I:= 0 to 10 do FalseDate(I):= Date(I);
|
||||
];
|
||||
];
|
||||
];
|
||||
Total:= Total + Line_tot;
|
||||
Readings:= Readings + Count;
|
||||
Line_avg:= Line_tot / float(Count);
|
||||
Print("Line: %s Reject: %2d Accept: %2d Line_tot: %4.3f Line_avg: %3.3f\n",
|
||||
Date, 24-Count, Count, Line_tot, Line_avg);
|
||||
];
|
||||
Print("\nFile = %s\n", File_name);
|
||||
Print("Total = %1.3f\n", Total);
|
||||
Print("Readings = %d\n", Readings);
|
||||
Print("Average = %1.3f\n", Total/float(Readings));
|
||||
|
||||
Print("\nMaximum run of %d consecutive false readings", FalseRun);
|
||||
Print("\nends at line starting with date: %s\n", FalseDate);
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue