skip to main |
skip to sidebar
/*PROGRAM TO ILLUSTRATE BOOKSHOP INVENTORY USING
CLASSES*/
#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<stdio.h>
class book
{
char name[25],author[25],pub[25],type[25];
float price,disc,org;
int pgno;
public:
void read();
void calc();
void display();
void show();
};
void book::read()
{
cout<<"ENTER THE DETAILS OF BOOK\n";
cout<<"----------------------------";
cout<<"\nEnter the Name:";
gets(name);
cout<<"\nEnter the name of Author:";
gets(author);
cout<<"\nEnter the name of Publication:";
gets(pub);
cout<<"\nEnter the type of Book:";
gets(type);
cout<<"\nEnter the page no:";
cin>>pgno;
cout<<"\nEnter the original price:";
cin>>org;
cout<<"\nEnter the discount:";
cin>>disc;
}
void book::display()
{
cout<<"\nPUBLICATION DETAILS\n";
cout<<"---------------------------";
cout<<"\nName:\t\t"<<name;
cout<<"\nAuthor:\t\t"<<author;
cout<<"\nPublication:\t"<<pub;
cout<<"\nType :\t\t"<<type;
cout<<"\npageno:\t\t"<<pgno;
}
void book::calc()
{
price =org-(disc/100*org);
}
void book::show()
{
cout<<"\nPrice:\t\t"<<price;
}
void main()
{
char ch;
book ob;
clrscr();
do
{
ob.read();
ob.calc();
ob.display();
ob.show();
cout<<"\nDo You Want to Continue?";
cout<<"\nY or N";
cin>>ch;
}
while(ch=='y'ch=='Y');
getch();
}
OUTPUT
ENTER THE DETAILS OF BOOK
-------------------------------------------
Enter the Name: Ente kadha
Enter the name of Author: Kamalasurayya
Enter the name of Publication: Surya
Enter the type of Book: Autobiography
Enter the page no:320
Enter the original price: 100
Enter the discount:30
PUBLICATION DETAILS
---------------------------------
Name: Ente kadha
Author: Kamalasurayya
Publication: Surya
Type of book : Autobiography
pageno:320
price:70
Do You Want to Continue?
Y or N
N
0 comments:
Post a Comment