c structure program,c structure example,c structure program examples,basic structure of c program,structure program in c using array,program of structure in c language,example of structure in c language,c programming struct example,definition of structure in c
syntax of structure in c,struct in c language,define struct in c,structure in c language
#include
#include
void main()
{
struct book
{
char book_name[20];
char author [20];
int price;
int page;
} s1,s2,s3;
char s;
clrscr();
printf("enter the first book name,author price,pages=\n");
scanf("%s%s%d%d",s1.book_name,s1.author,&s1.price,&s1.page);
printf("enter the 2nd book name,author price,pages=\n");
scanf("%s%s%d%d",s2.book_name,s2.author,&s2.price,&s2.page);
printf("enter the 3rd book name,author price,pages=\n");
scanf("%s%s%d%d",s3.book_name,s3.author,&s3.price,&s3.page);
printf("enter the book name to obtain details=\n");
scanf("%s",s);
if(strcmp(s,s1.book_name)==0)
printf("\nname=%s,\nauthor=%s,\nprice=%d,\npage=%d",s1.book_name,s1.author,s2.price,s1.page);
else
if(strcmp(s,s2.book_name)==0)
printf("\nname=%s,\nauthor=%s,\nprice=%d,\npage=%d",s2.book_name,s2.author,s2.price,s2.page);
else
printf("\nname=%s,\nauthor=%s,\nprice=%d,\npage=%d",s3.book_name,s3.author,s3.price,s3.page);
getch();
}