Program of libarary , C/C++ Programming

#include
#include
using namespace std;
class Book

{
private:
string title;
int iD;
int year_pub;
string author;
public:
string getTitle();
int getId();
int getYear_Pub();
string getAuthor();
void set(string,int,int,string);
};
void Book::set(string title,int iD,int year_pub,string author)
{
this -> title = title;
this -> iD = iD;
this -> year_pub = year_pub;
this -> author = author;
}
string Book ::getTitle()
{
return title;
}
int Book ::getId()
{
return iD;
}
int Book ::getYear_Pub()
{
return year_pub;
}
string Book ::getAuthor()
{
return author;
}
int main()
{

Book A,B,C;
int pick, year;

A.set("C++ Plus Data Structures:5th Edition",101,2013,"Nell Dale");
B.set("Starting out with C++: From Control Structures through Objects",102,1996,"Tony Gaddis");
C.set("C++ How to Program",103,2007,"Paul and Harvey Deitel");

cout<< "Welcome to Book Search"<do
{
cout< cout<<"Enter 1 to see all books."< cout<<"Enter 2 to search a book by the Year."< cout<<"Enter 3 to exit this program."< cout<<"Enter a number: "< cin >> pick;

switch(pick)

{
case 1:
cout< cout<<"There is 3 books here:"< cout<
cout<<"Title:"< cout<<"ID:"< cout<<"Year:"< cout<<"Author:"< cout<
cout<<"Title:"< cout<<"ID:"< cout<<"Year:"< cout<<"Author:"< cout<
cout<<"Title:"< cout<<"ID:"< cout<<"Year:"< cout<<"Author:"< break;
case 2:
cout<<"Please enter the year you would like to search"< cin >>year;
if (year==A.getYear_Pub())

{
cout<<"Title:"< cout<<"ID:"< cout<<"Year:"< cout<<"Author:"< cout< }

else if (year==B.getYear_Pub())
{
cout<<"Title:"< cout<<"ID:"< cout<<"Year:"< cout<<"Author:"< cout< }
else if(year==C.getYear_Pub())
{
cout<<"Title:"< cout<<"ID:"< cout<<"Year:"< cout<<"Author:"< cout< }
else
cout<<"There is no book by that year."<

break;
case 3:
cout<<"End of program."<

break;
default:
cout<<"Not a valid number.\n"
<<"Enter again."< }
}
while(pick !=3);

return 0;

}

Posted Date: 3/30/2013 1:58:19 AM | Location : United States







Related Discussions:- Program of libarary , Assignment Help, Ask Question on Program of libarary , Get Answer, Expert's Help, Program of libarary Discussions

Write discussion on Program of libarary
Your posts are moderated
Related Questions
Define External Storage Class - computer programming? When a variable is declared outside a function the storage is permanently assigned to it and its storage class is 'extern'

Define the Volatile Keyword Qualifiers in C Language? The volatile keyword proceed as a data type qualifier and a volatile variable is for dynamic use. E.G. for data that is to

void main() { int *p, *q, i ; p=(int*)100; q=(int*)200; i=q-p; printf("%d",i); } }

write a program to generate padovan sequence in c++

Define Four Facilities Provided by C Language Preprocessor? The C language preprocessor provides four separate facilities that you can use as you see fit:   Inclusion

Write a function that has a single int parameter n and returns an int: 0 if n is negative, otherwise 1. You are not allowed to simply check the integer value, and should use the fu

My project is compiling but the equation entered is not working

write a program that would accept the radius of the sphere and return its surface area.

Differentiate between the expression "++a" and "a++"? - With ++a, increment happens first on variable a, and resulting value is used. This is known as prefix increment. - Wi