#include<iostream.h>
#include<conio.h>
class book
{
int bid;
int balance;
int received;
int sold;
public:
void getdata()
{
cout<<"\nEnter Book Id: ";
cin>>bid;
cout<<"\nEnter inventory balance at the begining of the month : ";
cin>>balance;
cout<<"\nNumber of copies received during the month : ";
cin>>received;
cout<<"\nNumber of copies sold during the month : ";
cin>>sold;
}
void display()
{
cout<<"\nBook Id: "<<bid;
cout<<"\nUpdated Balance : "<<balance;
}
void update()
{
balance=balance+received-sold;
}
};
void main()
{
book b[5];
clrscr();
for(int i=0;i<5;i++)
{
b[i].getdata();
b[i].update();
b[i].display();
}
getch();
}
#include<conio.h>
class book
{
int bid;
int balance;
int received;
int sold;
public:
void getdata()
{
cout<<"\nEnter Book Id: ";
cin>>bid;
cout<<"\nEnter inventory balance at the begining of the month : ";
cin>>balance;
cout<<"\nNumber of copies received during the month : ";
cin>>received;
cout<<"\nNumber of copies sold during the month : ";
cin>>sold;
}
void display()
{
cout<<"\nBook Id: "<<bid;
cout<<"\nUpdated Balance : "<<balance;
}
void update()
{
balance=balance+received-sold;
}
};
void main()
{
book b[5];
clrscr();
for(int i=0;i<5;i++)
{
b[i].getdata();
b[i].update();
b[i].display();
}
getch();
}
0 comments:
Post a Comment