-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
52 lines (51 loc) · 1.53 KB
/
main.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
#include<stdio.h>
#include<ctype.h>
#include"functions.h"
#define RANGE 80
int main()
{
// calling different functions through main depending on the user input
int i=0,p=0;
char b[20];
char a[RANGE];
printf("\nWelcome to the project on Data Validation\n\nSelect the type of data validation\n\t1.Data Type Check\n\t2.Range Check\n\t3.Length Check\n\t4.Format Check\n\t5.Divisibility Check\n\t6.Email id Check\n\n");
scanf("%s",b);
i=b[0]-'0';
//if the user does not input the options correctly, we'll re ask the user by the following loop
while(i>6||i<1||b[1]!='\0')
{
printf("Enter a no. between 1 to 6\n");
scanf("%s",b);
i=b[0]-'0';
}
// a switch for calling the functions
switch(i)
{
case(1):
{
p=datatype(a,0);
}break;
case(2):
{
p=range(a,0);
}break;
case(3):
{
p=length(a,0);
}break;
case(4):
{
p=format(a,0);
}break;
case(5):
{
p=divisible(0,0);
}break;
case(6):
{
p=email(a);
printf("The email-id is valid\n");
}
}
return 0;
}