forked from ansh8tu/Project-META
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathactiveCountOfCovidCases.h
More file actions
46 lines (36 loc) · 1.02 KB
/
activeCountOfCovidCases.h
File metadata and controls
46 lines (36 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef ACTIVECOUNTOFCOVIDCASES_H
#define ACTIVECOUNTOFCOVIDCASES_H
extern int autoPId;
int activeCountOfCovidPatients(){
int CovidPatientCount = 0;
char ch = 'a';
FILE* tempLog;
tempLog = fopen("TemporaryRecord.txt","r");
char storeLine[100];
int it =0;
int varForSpaces = 1;
char *ptr;
while((ch=fgetc(tempLog))!=EOF) {
storeLine[it] = ch;
it++;
if(ch=='\n'){
varForSpaces=1;
for(int i=0; i<=it; i++){
if(storeLine[i] == ' '){
varForSpaces++;
}else if(varForSpaces == 6){
varForSpaces++;
if(storeLine[i]=='1')
{
CovidPatientCount++;
}
}else{}
}
it=0;
}
}
printf("\nThe number of active covid patients currently in Hospital are : %d \n", CovidPatientCount);
fclose(tempLog);
return CovidPatientCount;
}
#endif