43 lines
1.1 KiB
Plaintext
43 lines
1.1 KiB
Plaintext
include xpllib; \for Print, StrCmp and StrCopy
|
|
|
|
int Records, Invalid, AllGood;
|
|
char File_name, C, Date(10+1), LastDate(10+1);
|
|
int N, Flag, Count;
|
|
real Data;
|
|
|
|
[File_name:= "readings.txt";
|
|
Print("File = %s\n", File_name);
|
|
Print("\nDuplicated dates:\n");
|
|
FSet(FOpen(File_name, 0), ^i); OpenI(3);
|
|
|
|
Records:= 0; Invalid:= 0; AllGood:= 0;
|
|
LastDate(0):= 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;
|
|
if Date(0)#^1 and Date(0)#^2 then Invalid:= Invalid+1;
|
|
if StrCmp(Date, LastDate) = 0 then
|
|
Print("%s\n", Date);
|
|
StrCopy(LastDate, Date);
|
|
Records:= Records+1;
|
|
|
|
Count:= 0;
|
|
for N:= 0 to 24-1 do
|
|
[Data:= RlIn(3);
|
|
Flag:= IntIn(3);
|
|
if Flag > 0 then
|
|
Count:= Count+1;
|
|
];
|
|
if Count = 24 then AllGood:= AllGood+1;
|
|
];
|
|
Print("\nTotal number of records : %d\n", Records);
|
|
Print("Number of invalid records : %d\n", Invalid);
|
|
Print("Number which are all good : %d (%1.2f^%)\n",
|
|
AllGood, float(AllGood)/float(Records)*100.0);
|
|
]
|