Program of libarary , C/C++ Programming

Assignment Help:

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

}


Related Discussions:- Program of libarary

Smuggler, Smugglers are becoming very smart day by day. Now they have devel...

Smugglers are becoming very smart day by day. Now they have developed a new technique of sending their messages from one smuggler to another. In their new technology, they are send

Write a procedure to add and subtract-money, Money is immutable and is asso...

Money is immutable and is associated with a currency. When two money entities are added or subtracted be sure to consider currency conversion. You must create a money object result

Compter graphices, program that generate university statistical bar graph u...

program that generate university statistical bar graph using 3d function

What is some reward/drawback of using friend functions?, A: They present a ...

A: They present a degree of freedom in the interface design options. Member functions & friend functions are equally privileged (100% vested). The major difference is that a fri

Working with files in cpp, Operation Files 2.1. Your program should open an...

Operation Files 2.1. Your program should open and read the file specified by the first command line argument of the program. 2.2. The first line of the file contains an integer

C program to define power of a function, C program to define power of a fun...

C program to define power of a function: Write a program to use power of a function. void main() { int x,y,po=1,i,j; clrscr();   printf("Give x,y\n"); sca

Explain the function of five elements that are on a, explain the function o...

explain the function of five elements that are found on a motherboard#

COMPUTER, THEORY OF A COMPUTER PROGRAMMING

THEORY OF A COMPUTER PROGRAMMING

What is virtual class and friend class, Friend classes are used when two or...

Friend classes are used when two or more classes are designed to work together and require access to each other's execution in ways that the rest of the world shouldn't be permitte

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd