NBA - Boston Celtics

Sunday, 15 January 2012

structure to create your own data type in c..........


#include<conio.h>
#include<stdio.h>
struct book_info
{
 char title[10];
 char author_name[10];
 int pages;
 float price;
};
void main()
{
 struct book_info book1,book2;
clrscr();
   printf("enter the information about the book = ");
   scanf("%s%s%d%f",book1.title,book1.author_name,&book1.pages,&book1.price);
   printf("\n\n\t\t\t\tthe details of book are below:-\n");
   printf("title = %s\n\nauthor_name = %s\n\npages = %d\n\nprice =                %f",book1.title,book1.author_name,book1.pages,book1.price);  
getch();
}

No comments:

Post a Comment