View Single Post
  #1 (permalink)  
Old January 28th, 2004, 09:32 PM
amahja56 amahja56 is offline
Authorized User
 
Join Date: Jan 2004
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default PLEASE PLEASE HELP ME

hello.....I have a problem with this question ppl....I tried so much to do it but i coulnt. here is the queston..and then my code:

CREATE A CLASS CALLED CARD THAT MAINTAINS A LIBRARY CARD CATALOG ENTRY. HAVE THE CLASS STORE A BOOK;S TITLE,AUTHOR AND NUMBER OF COPIES ON HAND. STORE THE TITLE AND AUTHOR AS STRINGS AND THE NUMBER ON HAND AS INTEGER. USE A PUBLIC MEMBER FUNCTION CALLED store() TO STORE A BOOK'S INFORMATION AND A PUBLIC MEMBER FUNCTION CALLED show()
TO DISPLAY THE INFORMATION. INCLUDE A SHORT main() FUNCTION TO DEMONSTRATE THE CLASS.

*please help me..


ans here is my code:

# include <iostream.h>
# include <conio.h>

class card
{
private:
char book;
int author;
int nocopies;

public:
void store();
void show();
};

void card::store()
{
cout<<"enter book title:";
cin>>book;
cout<<" nenter the author's name:";
cin>>author;
cout<<" nenter the number of copies:";
cin>>nocopies;
}

void card::show()
{
cout<<"\nthe book title is:"<<book;
cout<<"\nthe athor's name is:"<<author;
cout<<"\nthe number od copies are:"<<nocopies;
}





int main()
{

card book;
card author;
card nocopies;

book.show();
author.show();
nocopies.show();

getch();
}





Reply With Quote