-
Notifications
You must be signed in to change notification settings - Fork 1
/
A4 Q2.c
127 lines (81 loc) · 1.55 KB
/
A4 Q2.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#include<stdio.h>
#include<string.h>
struct library{
int a_number;
char name[100] ;
char book_title[100];
}b[2];
main(){
int i;
printf("enter book accession number \n enter author name \n enter book title\n");
for(i=0;i<2;i++)
{
scanf("%d",&b[i].a_number);
scanf("%s",&b[i].name);
scanf("%s",&b[i].book_title);
}
for(i=0;i<2;i++)
{
printf("%d \n",b[i].a_number);
printf("% \ns",b[i].name);
printf("%s \n",b[i].book_title);
}
char name2[30];
strcpy(b[2].name,name2);
for(i=0;i<2;i++)
{
if (strcmp(b[i].name,name2))
{
printf("%d \n",b[i].a_number);
printf("%s \n",b[i].name);
printf("%s \n",b[i].book_title);
}
}
char title[100];
strcpy(b[2].book_title,title);
int count=0 ;
for(i=0;i<2;i++)
{
if ( strcmp(b[i].book_title,title))
{
count++;
}
}
int count2;
printf("\nthe count of particular title books are=%d\n",count);
for(i=0;i<2;i++)
{ b[i].book_title;
count2++;
}
printf("\nthe count of books are=%d\n",count2);
int mm;
printf("enter 0 for exit \n");
scanf("%d",&mm);
do{
int mm;
printf("enter 0 for exit \n");
scanf("%d",&mm);
char u ;
char q;
printf("do you want to issue a book Y OR N? \n");
scanf("%c",&u);
if(u == 'y' || u == 'Y')
{
count2--;
}
else
{
break;
}
printf("do you want to give it back Y OR N \n ?");
scanf("%c",&q);
if(q=='Y'|| q == 'y')
{
count2++;
}
else{
break;
}
}
while ( mm != 0 );
}