answersLogoWhite

0


Best Answer

/*Name of Student:- Ravi Ranjan

Section:- M2111

Roll No. :- A13

Subject:- CSE Term Paper on Book Sale And Purchase System

Date:- 11 November 2011

Submitted To:- Miss. Rimple Gilhotra */

#include<stdio.h>

#include<conio.h>

#include<string.h>

struct record

{

char author[20];

char title[30];

float price;

struct

{

char month[10];

int year;

}

date;

char publisher[10];

int quantity;

};

int look_up(struct record table[],char s1[],char s2[],int m);

void get(char string [ ]);

main()

{

char title[30],author[20];

int index,no_of_records;

char response[10], quantity[10];

struct record book[]= {

{"Steven","Lpu Chemistry",90.00,"June",1998,"Wiley",500},

{ "Ritche","C Language",45.00,"May",1977,"PHI",100},

{ "Kotchan","Programming in C",75.50,"July",1983,"Hayden",150},

{ "Pytel","Basic",30.00,"January",1984,"TMH",100},

{ "Pytel","Cobol",60.00,"December",1988,"Macmillan",250},

{"Balagurusamy","BASIC",30.00,"January",1984,"TMH",20},

{"Balagurusamy","COBOL",60.00,"December",1988,"Macmillian",25}

};

clrscr();

no_of_records=sizeof(book)/sizeof(struct record);

do

{

printf("Enter title and author name as per the list\n");

printf("\n Title:");

get(title);

printf("Author:");

get(author);

index=look_up(book,title,author,no_of_records);

if(index!=-1)

{

printf("\n %s %s %.2f %s %d %s\n\n",

book[index].author,

book[index].title,

book [index].price,

book[index].date.month,

book[index].date.year,

book[index].publisher);

printf("Enter number of copies");

get(quantity);

if(atoi(quantity) < book[index].quantity)

printf("cost of %d copies=%.2f\n",atoi(quantity),

book[index].price*atoi(quantity));

else

printf("\n required copies not in stock\n\n");

}

else

printf("\n Book not in list \n\n");

printf("\n Do you want any other book?(YES/NO):");

get(response);

}

while(response[0]=='Y' response[0]=='y');

printf("\n\nthank you.good bye!\n");

}

void get(char string [])

{

char c;

int i=0;

do

{

c=getchar();

string[i++]=c;

}

while(c !='\n');

string[i-1]='\0';

}

int look_up(struct record table[],char s1[],char s2[],int m)

{

int i;

for(i=0;i<m;i++)

if(strcmp(s1,table[i].title)==0 &&

strcmp(s2,table[i].author)==0)

return(i);

return(-1);

}

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a Program of book store management written in c?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Where does a computer store a program and the data that the program is working with while the program is running?

secondary storage


What will be Code for creating departmental store management system using JSP?

what is departmental store?


Is it possible to write a C plus plus or java program to draw an activity flow diagram given the sequence as a text file input and store the diagram in an output file?

Yes, this is possible.


What is psen pin in 8051?

Program Store Enable: The read strobe to external program memory.


How do you write program c of table 5?

#include#includevoid main(){ int a,i;printf("\nThe Multiplication table of 5 is:\n");for(i=1;i

Related questions

How can I have a mobile application for my online store done?

You would have to pay a computer programmer to write an application program for your store.


Is it more efficient to store the data in a matrix then write it to the file at the end of the program or to write each element to the file as the program runs?

It shouldn't make significant difference, only if the matrix is huge -- in that case you shouldn't store it in memory.


Write a c program to accept name and store the name in its short form?

happy birthday...


Is there a good password management program to store all my passwords?

Firefox offers the ability to store passwords from various websites. This is a free download available at getfirefox.com


Write a program to accept name and store the name in it's short form as eg sikkim manipal university SMU?

Write a program to accept name and store the name in its short form (e.g. Sikkim Manipal University should be stored as SMU)


Where can a person find information on content management solutions?

A Content management system is a computer program that allows editing, publishing and modifying content of an interface. The information is then store on computers.


How can write a c program to store students record in a file?

Write a console based C++ program that reads student information from a text file, build an array of objects of type class StudentInfo,


What has the author Paul H Nystrom written?

Paul H. Nystrom has written: 'Retail store operation' -- subject(s): Retail trade 'Retail selling and store management' -- subject(s): Retail trade, Sales management, Selling 'Automobile selling' 'Retail institutions and trends' -- subject(s): Retail trade 'Retail store management' -- subject(s): Retail trade


What has the author Krystyna Robinson written?

Krystyna Robinson has written: 'Data and retailing' -- subject(s): Store location, Management, Management information systems, Marketing, Electronic data processing, Retail trade


What has the author James V Calabrese written?

James V. Calabrese has written: 'Are you the store manager?' -- subject(s): Grocery trade, Management


What has the author Mort Brown written?

Mort Brown has written: 'So you want to own the store' -- subject(s): Management, Retail Stores, Stores, Retail


How do you become a chocolate maker?

You and your manager (when applicable) will be required to complete a comprehensive training program at the corporate headquarters in Windsor, New Jersey. The program will cover all of the areas that are vital to your store's operation, including inventory management, quality standards, and personnel management. You will learn by working in one of our retail stores.