-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathlibrary management system
53 lines (53 loc) · 1.48 KB
/
library management system
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
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
struct library{
char bookname[50];
char author[50];
int noofpages;
float price;
};
int main(){
struct library lib[100];
char bookname[30];
int i,j, keepcount;
i=j=keepcount = 0;
while(j!=6){
printf("\n1. Add book information\n");
printf("2.Display book information\n");
printf("3. no of books in the library\n");
printf("4. Exit");
printf ("\n\nEnter one of the above : ");
scanf("%d",&j);
switch (j){
case 1:
printf ("Enter book name = ");
scanf ("%s",lib[i].bookname);
printf ("Enter author name = ");
scanf ("%s",lib[i].author);
printf ("Enter pages = ");
scanf ("%d",&lib[i].noofpages);
printf ("Enter price = ");
scanf ("%f",&lib[i].price);
keepcount++;
i++;
break;
case 2:
printf("you have entered the following information\n");
for(i=0; i<keepcount; i++){
printf ("book name = %s\n",lib[i].bookname);
printf ("\t author name = %s\n",lib[i].author);
printf ("\t pages = %d\n",lib[i].noofpages);
printf ("\t price = %f\n",lib[i].price);
}
break;
case 3:
printf("\n No of books in library : %d", keepcount);
break;
case 4:
exit (0);
}
}
return 0;
}