-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearchOrDelete.c
62 lines (61 loc) · 1.14 KB
/
searchOrDelete.c
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include "dataFormat.h"
int main (int menu)
{
char input[32];
int year = -1;
int i;
int correct = 1;
memset(input,0,sizeof(input));
switch (menu)
{
case 1:
do
{
printf("Search by EVENT CODE : ");
fgets(input,sizeof(input),stdin);
if (strlen(input)==0 || strlen(input)>10)
{
correct = 1;
}
else if (input[4] != ':')
{
correct = 1;
}
else
{
for(i=0;i<4;i++)
{
if(isdigit(input[i])==0)
{
correct = 1;
}
}
for(i=5;i<9;i++)
{
if(isdigit(input[i])==0)
{
correct = 1;
}
}
correct = 0;
}
}while (correct == 1);
break;
case 2:
do
{
printf("Search by EVENT YEAR : ");
fgets(input,sizeof(input),stdin);
sscanf(input,"%d",&year);
}while (year < 1 || year > 3000);
break;
case 3:
printf("\t\t Search by DISTRICT \t\t\n");
checkDistrict(input);
break;
}
printf("Your search %s\n",input);
}