Toggle navigation
Home
Latest pastes
FAQ
Random
Register
Login
Write a C++ Program using Concept of array of object.
SUBMITTED BY:
Nrupeshsinh
DATE:
July 4, 2016, 1:54 p.m.
FORMAT:
Text only
SIZE:
652 Bytes
Raw
Download
Tweet
HITS:
343
Go to comments
Report
# include<iostream.h>
# include<conio.h>
class Library
{
public:
char name[20];
float price;
void bookname();
void bookprice();
};
void Library :: bookname()
{
cout<<"enter name=";
cin>>name;
cout<<"enter price";
cin>>price;
}
void Library :: bookprice()
{
cout<<"NAME="<<name<<endl;
cout<<"PRICE="<<price<<endl;
}
void main()
{
clrscr();
int i;
Library Library1[5];
for(i=0; i<5; i++)
{
cout<<"Library Details"<<endl;
cout<<"book name"<<i+1<<endl;
Library1[i].bookname();
}
cout<<"\n";
for(i=0; i<5; i++)
{
cout<<"book price"<<i+1<<endl;
Library1[i].bookprice();
}
getch();
}
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus