Hi, I have make an abstract base class called Holding and I have to make two derived classes that use some virtual functions. I have already made these classes but on top of all this I have to make a library.cpp that uses these functions. The output for the program is very weird. It outputs the first two lines just fine and then where it asks for me to put in b or r I do and sometimes it goes right to asking the book title and sometimes it completely skips over the input and asks for me to put in b or r for book or recording. Rarely, does it go through one loop successfully. Success is when it asks for the book title author and call number and then it asks for another holding. Basically what I am supposed to do for the main function is to declare an array of five pointers to Holding objects an then call a function that makes a new Holding. The function will ask which kind of holding is to be entered and inputs the data to make a book or a recording. Then a new object should be made with this data and the pointer that results should be returned. The function can be declared to return a Holding pointer and the pointer to the newly created object can be returned without conversion. This pointer is stored in the array and the function is called again and again until the five objects have been created. The program should also be able to run through the array and call the virtual print function for each object. I will post all my code below. Again I am having problems with the main function in library.cpp. Thanks.

Code:
//holding.h

#ifndef _Holding_H
#define _Holding_H

#include <iostream>


class Holding
{
public:
	Holding();
	Holding(const char *str);
	virtual void settitle() =0;
	virtual void setcallnum() =0;
	virtual void print() =0;
	virtual ~Holding();

private:
	char *buf;

};

#endif

//holding.cpp

#define _CRT_SECURE_NO_DEPRECATE 1
#include <iostream>
#include "holding.h"

using namespace std;

Holding::Holding()
{
	buf = new char[1];
	buf[0] = '\0';
}

Holding::Holding(const char *str)
{
	buf = new char[strlen(str) + 1];
	strcpy(buf, str);
}

Holding::~Holding()
{
	delete []buf;
}


//book.h

#ifndef _Book_H
#define _Book_H

#include <iostream>
#include "holding.h"

class Book: public Holding
{
public:
	Book();
	Book(const char *s);
	virtual ~Book();
	virtual void settitle();
	void setbookauthor();
	virtual void setcallnum();
	virtual void print();

private:
	char booktitle;
	char bookauthor;
	char bookcallnum;
	char *bbuf;

};

#endif


//book.cpp

#define _CRT_SECURE_NO_DEPRECATE 1
#include <iostream>
#include "book.h"

using namespace std;

Book::Book()
{
	bbuf = new char[1];
	bbuf[0] = '\0';
}

Book::Book(const char *s)
{
	bbuf = new char[strlen(s) + 1];
	strcpy(bbuf, s);
}

Book::~Book()
{
	delete []bbuf;
}

void Book::settitle()
{
	cout<< "Enter book title: " << endl;
	cin>> booktitle;
	cin.get();
}

void Book::setbookauthor()
{
	cout<< "Enter book author: " << endl;
	cin>> bookauthor;
	cin.get();
}

void Book::setcallnum()
{
	cout<< "Enter call number: " << endl;
	cin>> bookcallnum;
	cin.get();
}

void Book::print()
{
	cout<< "BOOK: """ << booktitle << """" << bookauthor << bookcallnum << endl;
}

//record.h

#ifndef _Recording_H
#define _Recording_H

#include <iostream>
#include "holding.h"

class Recording: public Holding
{
public:
	Recording();
	Recording(const char *str);	
	virtual ~Recording();
	virtual void settitle();
	void setrecperformer();
	virtual void setcallnum();
	void setrecformat();
	virtual void print();	

private:
	char rectitle;
	char recauthor;
	char reccallnum;
	char recformat;
	char *rbuf;

};

#endif

//record.cpp

#define _CRT_SECURE_NO_DEPRECATE 1
#include <iostream>
#include "record.h"

using namespace std;

Recording::Recording()
{
	rbuf = new char[1];
	rbuf[0] = '\0';
}

Recording::Recording(const char *str)
{
	rbuf = new char[strlen(str) + 1];
	strcpy(rbuf, str);
}

Recording::~Recording()
{
	delete []rbuf;
}


void Recording::settitle()
{
	cout<< "Enter recording title: " << endl;
	cin>> rectitle;
	cin.get();
}

void Recording::setrecperformer()
{
	cout<< "Enter performer: " << endl;
	cin>> recauthor;
	cin.get();
}

void Recording::setcallnum()
{
	cout<< "Enter call number: " << endl;
	cin>> reccallnum;
	cin.get();
}

void Recording::setrecformat()
{
	cout<< "Enter format: (L)P, (C)assette, (R)eel_to_reel, (D)isk:" << endl;
	cin>> recformat;
	cin.get();
}

void Recording::print()
{
	cout<< "RECORDING: """<< rectitle << """" << recauthor << recformat << reccallnum << endl;
}

//library.h

#include <iostream>
#include "holding.h"
#include "book.h"
#include "record.h"

//library.cpp

#include <iostream>
#include "library.h"


using namespace std;

int main()
{
	Holding *ptr[5];
	Book *bptr;
	Recording *rptr;
	char choice;
	cout<< "Enter holdings to be stored in a list: " << endl;
	for(int i = 0; i<5; i++)
	{
		cout<< "Enter B for book, R for recording: " << endl;
		cin>> choice;
		if(choice == 'b' || choice == 'B')
		{
			bptr = new Book;
			bptr->settitle();
			bptr->setbookauthor();
			bptr->setcallnum();
			ptr[i] = bptr;

		}
		if(choice == 'r' || choice == 'R')
		{
			rptr = new Recording;
			rptr->settitle();
			rptr->setrecperformer();
			rptr->setrecformat();
			rptr->setcallnum();
			ptr[i] = rptr;
		}

	}
	for(int k = 0; k<5; k++)
		ptr[k]->print;
}