#include<iostream.h>
#include<stdio.h>
#include<conio.h>
class BOOK
{
int BOOKNO;
char BOOKTITLE[20];
float PRICE;
void TOTAL_COST(int N)
{
float tcost;
tcost=PRICE*N;
cout<<tcost;
}
public:
void INPUT()
{
cout<<"Enter Book Number ";
cin>>BOOKNO;
cout<<"Enter Book Title ";
gets(BOOKTITLE);
cout<<"Enter price per copy ";
cin>>PRICE;
}
void PURCHASE()
{
int n;
cout<<"Enter number of copies to purchase ";
cin>>n;
cout<<"Total cost is ";
TOTAL_COST(n);
}
};
void main()
{
BOOK obj;
obj.INPUT();
obj.PURCHASE();
getch();
}
Nice post.The given example is very helpful.Iam working in a company.which provides custom software services. Try what custom software services.
ReplyDeleteBhai glt h program run nhi ho rha koi mtlb nhi h
ReplyDeleteSend your Error ....
DeleteSir hame ek programm nahi aa raha kya ap hamari help karoge
ReplyDeleteWrite a C++program to declare a class book having data member bookname author and prize accept and display data for book having maximum price
Plz solve this...write a program that inputs books quantity and price and calculate and display total cost.
ReplyDeleteWAP to read ,write and search information about books in a college library(Title ,author,edition,year of publication ,price ,accession number and number of copies) record wise in a file. facilitate search on the basis of the accession number.
ReplyDeleteImplement a vehicle database containing chasis_number,model_year using array of objects.Design relevant functions to add records,calculate the number of objects created for that class.
ReplyDeleteDo this example in php
ReplyDelete