I need help with 5 error messages. I'm new at c++ so I don't understand what these errors mean or I don't see what I did wrong.
Script started on Tue Dec 04 17:01:36 2001
strauss.udel.edu% cat librar cat library.h
//header file for library class
#ifndef Library_H
#define Library_H
#include "book.h"
#include "card.h"
#include <fstream.h>
#include <iostream.h>
class Library {
private:
char command;
static int num_books;
static int num_cards;
Book *books[100];
Card *cards[100];
void printcards();
void printbooks();
void checkout();
void checkin();
public:
Library(ifstream &input);
~Library();
void DoCommand(char);
Book* Findbook(int);
Card* Findcard(int);
static int getnum_books;
static int getnum_cards;
};
#endif
strauss.udel.edu% cat libraray y.cc
//member definition for library class
#include "book.h"
#include "card.h"
#include "library.h"
#include <string.h>
#include <fstream.h>
#include <iostream.h>
Library :: Library(ifstream &input) {
Book *book;
Card *card;
char title[100];
char author[100];
char name[100];
char phone[100];
int BookID;
int BID;
int CardID;
int CID;
int status;
int i =0, j = 0;
input.getline(title, 100);
for(int i = 0; i < 100; i++) {
books[i] = NULL;
i = 0;
while(strcmp(title, $$$) != 0) {
input.getline(author, 100);
input >> BookID >> status >> CID;
books[i] = new Book(title, author, BookID, status, CID);
num_books++;
input.ignore();
input.getline(title, 100);
i++;
}
}
input.getline(name, 100);
for(int j = 0; j < 100; j++) {
cards[j] = NULL;
j = 0;
while(!input.eof()) {
input.getline(phone, 100);
input >> CardID >> BID;
cards[j] = new Card(name, phone, CardID, BID);
num_cards++;
input.ignore();
input.getline(name, 100);
j++;
}
}
}
Book* Library :: Findbook(int b) {
int i = 0;
while(books[i] != NULL) {
if(books[i]->getBookID() == b)
return books[i];
else
i++;
}
cout >> "Book not found";
return NULL;
}
Card* Library :: Findcard(int c) {
int j = 0;
while(!input.eof()) {
if(cards[j]->getCardID() == c)
return cards[j];
else
j++;
}
cout >> "Card not found";
return NULL;
}
void Library :: DoCommand(char c) {
command = c;
int i = 0, j = 0, BookID, CardID;
if(command = 'B'){
while(books[i] != NULL) {
cout << "Processing book - ";
books[i]->print() ;
cout << endl;
i++;
}
cout << num_books << "books in the library" << endl;
}else if(command = 'C') {
while(cards[j] != NULL) {
cout << "Processing card - ";
cards[j]->print();
cout << endl;
j++;
}
cout << num_cards << "cards in the library" << endl;
}else if(command = 'O') {
cout << "Enter book ID: ";
cin >> BookID;
Findcard(CardID);
cout << "Enter card ID: ";
cin >> CardID;
Findbook(BookID);
if(books[i]->getBookID() != 0) {
cout << "Sorry. You can't check out a book until"
<< "you return the book that you checked out"
<< "before." << endl;
}else {
if(books[i]->getstatus() == 0) {
books[i]->setstatus(1);
cards[j]->setBookID(BookID);
books[i]->setCardID(CardID);
}else if(books[i]->getstatus() == 1) {
cout << "Sorry, but the has already been"
<< "checked out."<< endl;
}else {
cout << "Book is at the bindery."<< endl;
}
}
}else if(command = 'W') {
cout << "Enter book ID: ";
cin >> BookID;
Findbook(BookID);
cout << "Enter card ID: ";
cin >> CardID;
Findcard(CardID);
if(books[i]->getBookID() == 0) {
cout << "You do not have any books checked out" << endl;
}else {
if(books[i]->getstatus() == 1){
books[i]->setstatus(0);
cards[j]->setBookID(BookID);
}
}
}
}
strauss.udel.edu% make
CC -c library.cc
"library.cc", line 28: Error: Expected an expression.
"library.cc", line 62: Error: The operation "std::basic_ostream<char, std::char_traits<char>> >> const char*" is illegal.
"library.cc", line 67: Error: input is not defined.
"library.cc", line 67: Error: Badly formed expression.
"library.cc", line 73: Error: The operation "std::basic_ostream<char, std::char_traits<char>> >> const char*" is illegal.
5 Error(s) detected.
*** Error code 5
make: Fatal error: Command failed for target `library.o'
strauss.udel.edu% exit
strauss.udel.edu%
script done on Tue Dec 04 17:01:59 2001