Subject: please help me with this..
Posted By: amahja56 Post Date: 1/27/2004 6:21:47 PM
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 By: ankur_vachhani Reply Date: 1/30/2004 6:43:22 AM
quote:
Originally posted by amahja56



CHANGE THE CODE AS FOLLOWS

# 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 my_book;


my_book.store();
my_book.show();


getch();
}






 



Reply By: nikolai Reply Date: 1/30/2004 3:41:56 PM
Why the cross post?
  http://p2p.wrox.com/topic.asp?TOPIC_ID=9109


Take care,

Nik
http://www.bigaction.org/

Go to topic 9211

Return to index page 958
Return to index page 957
Return to index page 956
Return to index page 955
Return to index page 954
Return to index page 953
Return to index page 952
Return to index page 951
Return to index page 950
Return to index page 949