-
Notifications
You must be signed in to change notification settings - Fork 0
/
studentInfo.c
83 lines (63 loc) · 1.52 KB
/
studentInfo.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#include <stdio.h>
#include <string.h>
char stuno[12];
char stu_name[15];
char stu_mobile[10];
int Stu_No_sizecheck(int defaultVal,int sizeEn);
int Mobile_sizecheck(int defaultVal,int sizeEn);
char get_stu_info()
{
printf("Enter Your Student NO: \n");
printf("Eg: EC2022012\n");
scanf("%s", stuno);
Stu_No_sizecheck(9,strlen(stuno));
printf("\nEnter Your Name: \n");
printf("Eg: malan (use only simple letters for name)\n");
scanf("%s", stu_name);
printf("\nEnter Your Mobile No: \n");
printf("Eg: 0710000000\n");
scanf("%s", stu_mobile);
Mobile_sizecheck(10,strlen(stu_mobile));
}
char *print_stu_no()
{
// this char* use to return string because we cant directly return string value. this is the returing the pointer method
// printf("\n%s",stu_info[0]);
return stuno;
}
char *print_stu_name()
{
// printf("\n%s",stu_info[1]);
return stu_name;
}
char *print_stu_mobile()
{
// printf("\n%s",stu_info[2]);
return stu_mobile;
}
int Stu_No_sizecheck(int defaultVal,int sizeEn){
int i=1;
while(i){
if (defaultVal == sizeEn){
i=0;
}
else{
printf("Invalid Input Check the Example and Re Enter \n");
scanf("%s", stuno);
sizeEn = strlen(stuno);
}
}
}
int Mobile_sizecheck(int defaultVal,int sizeEn){
int i=1;
while(i){
if (defaultVal == sizeEn){
i=0;
}
else{
printf("Invalid Input Check the Example and Re Enter \n");
scanf("%s", stu_mobile);
sizeEn = strlen(stu_mobile);
}
}
}