void CheckOut(Card c[], book b[], int, int);
void ShowMenu();
int CreateCard(Card cards[], int numCards);
void PrintAllCards(Card cards[], int numCards);
void PrintAllBooks ( book books[], int numBooks);
void CheckIn(Card c[],book b[], int, int);
int main()
{
int numBooks = 0;
int numCards = 0;
int i = 0, j = 0;
int command = 0;
// declare an array of 20 cards
Card cards[20];
// declare an array of 20 books
book books[20];
// declare a file pointer and open the cards file
ifstream cardInput("cards.txt");
if (!cardInput)
{
cout << "File cards.txt could not be openned. Fatal Error" << endl;
exit(1);
}
cout << "File openned. Reading cards..." << endl;
// read the next line from the file
char name[15];
char junk[5];
char phone[14];
int cardID = 0;
int temp = 0;
}
cardInput.close();
// tokenize the line to get the data for class variables
ifstream BookInput("books.txt");
if (!BookInput)
{
cout << "File books.txt could not be openned. Fatal error." << endl;
exit(1);
}
book working(BookID, Title, Author);
books[i] = working;
i++;
}
BookInput.close();
// display main menu
do{
ShowMenu();
cin >> command;
// execute the appropriate command
switch (command){
case 0:
break;
case 1:
// call function to print all cards
PrintAllCards(cards, numCards);
break;
case 2:
// call functions to print all books
PrintAllBooks(books, numBooks);
break;
case 3:
// call to check out book
CheckOut(cards, books, numCards, numBooks);
break;
case 4:
// call to check in book
CheckIn;
break;
case 5:
// create new library cards
numCards = CreateCard(cards, numCards);
break;
default:
cout << "INVALID. Menu choices must be btween 0 and 5.";
}
ShowMenu();
while (command != 0)
{
}
void ShowMenu();
{
cout << " ------------------------------------- " << endl << endl;
cout << "1. Show all Library Cards " << endl;
cout << "2. Show all Books " << endl;
cout << "3. Check out a Book " << endl;
cout << "4. Check in a Book " << endl;
cout << "5. Create a new Library Card " << endl;
cout << "0. Exit the system " << endl << endl;
}
int CreateCard(Card cards[], int numCards);
{
char name[30];
char phone[20];
int cardID = 0;
// add 1 to CardID to get ne CardID
cout << "Enter the Card ID: ";
cin >> cardID;
// ask for name
cout << "Enter your Name: ";
cin >> name;
// ask for phone number
cout << "Enter your Phone Number: ";
cin >> phone;
class Card
{
private:
int CardID;
char Name[30];
char Phone[20];
int BookID;
public:
Card();
Card(char n[], char p[], int c);
int getCardID();
int getBookID();
int setBookID();
int c = 0;
void printName();
bool hasBook();
void checkOut(int b);
void checkIn();
void print();
};
#endif
book.h
#ifndef Book_H
#define Book_H
#include <iostream>
#include <iomanip>
class book
{
private:
int BookID;
char Title[30];
char Author[30];
bool CheckedOut;
int CardID;
public:
book();
book(int b, char t[], char a[]);
int getBookID();
int getCardID();
int setCardID();
int nCard = 0;
void printTitle();
bool isCheckedOut();
void checkOut(int c);
void checkIn();
void print();
};
#endif
Error 2 error C2664: 'Card::Card(const Card &)' : cannot convert argument 1 from 'int' to 'char []
Error 7 error C2660: 'Card::setBookID' : function does not take 1 arguments
Error 3 error C2660: 'book::setCardID' : function does not take 1 arguments
Error 4 error C2059: syntax error : '}'
Error 7 IntelliSense: expected 'while'
Error 5 IntelliSense: too many arguments in function call
Error 6 IntelliSense: too many arguments in function call
Warning 1 warning C4551: function call missing argument list
Sorry, my teacher did not show us how to use tags, and the int c = 0; is not supposed to be there. I am new to this, and my teacher is not helping! My big problem is the expecting while, and Card::setBookID' : function does 'book::setCardID' : function does not take 1 arguments