Wrox Programmer Forums
|
C++ Programming General discussions for the C++ language. For questions specific to Microsoft's Visual C++ variant, see the Visual C++ forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C++ Programming section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old January 27th, 2004, 07:21 PM
Authorized User
 
Join Date: Jan 2004
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default please help me with this..

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
  #2 (permalink)  
Old January 30th, 2004, 07:43 AM
Authorized User
 
Join Date: Jan 2004
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to ankur_vachhani
Default

Quote:
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 With Quote
  #3 (permalink)  
Old January 30th, 2004, 04:41 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Why the cross post?
  http://p2p.wrox.com/topic.asp?TOPIC_ID=9109


Take care,

Nik
http://www.bigaction.org/
Reply With Quote









Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.