-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathSem3 Day1.c
105 lines (91 loc) · 2.46 KB
/
Sem3 Day1.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
void main(){
FILE *fptr,*fptr1;
char lname[20],name[20],cnf[4][20];
long long enroll;
int i=1,w;
fptr = fopen("file.txt","a");
fptr1 = fopen("file.txt","r");
printf("Choose from the Following Functions...\n\t1. Input in Record\n\t2. Show All Records\n\t3. Sort\n\t4. Search\n\t5. Delete\n\t6. List Of Subjects\n\t7. List Of Faculty\n");
scanf("%d",w);
switch(w){
case 1:
Input(fptr,lname,name,cnf,s,enroll,i);
system("pause");
break;
case 2:
Show(fptr1);
system("pause");
break;
case 3:
Sort(fptr1,i);
system("pause");
break;
case 4:
Search(fptr1,i);
system("pause");
break;
case 5:
Delete(fptr);
system("pause");
break;
case 6:
Retrieve_List_Of_Subjects(fptr1,i);
system("pause");
break;
case 7:
Retrieve_Names_Of_Faculty(fptr1,i);
system("pause");
break;
}
}
void Input(FILE *fptr, char lname[20],name[20],cnf[4][20], long long enroll, int i=1)
{
printf("Last Name? ");
scanf("%s",lname);
fprintf(fptr,"Last Name: %s\t",lname);
printf("Name? ");
scanf("%s",name);
fprintf(fptr,"Name: %s\t",name);
printf("Enroll? ");
scanf("%lld",&enroll);
fprintf(fptr,"Enroll: %lld\t",enroll);
fprintf(fptr,"Course & Faculty:");
while(i<=4){
printf("Course & Faculty %d?",i);
scanf("%s",cnf[i-1]);
fprintf(fptr," %s",cnf[i-1]);
if(i!=4){
fprintf(fptr,",");
}
else{
fprintf(fptr,".\t");
}
i++;
}
fclose(fptr);
}
void Sort(FILE *fptr1)
{
int w;
char a;
printf("Which Sort? 1.Bubble 2.Insertion 3.Selection\n");
scanf("%d",w);
switch(w){
case 1:
fscanf("Last Name: %s\t");
printf("Sort By? 1.Last Name 2.First Name 3.Course&Faculty 4.Enroll");
scanf("%c",a);
system("pause");
break;
case 2:
system("pause");
break;
case 3:
system("pause");
break;
}
fclose(fptr);
}