So once again I need some help with this program for class. Maybe its that I’m tired but I can’t seem to find the logic error I’m sure I’ve made here. Here is my code:
#include "Book.h"
using namespace std;
void add (char*, char*, int);
void remove (int&);
void list ();
int Count;
Book Bookshelf [4];
int main ()
{
string In;
string N;
string A;
int Y;
int Num;
do
{
cout << "Bookshelf> ";
getline(cin, In);
if (In.compare("add") == 0)
{
cout << "Bookshelf> Enter book: ";
cin >> N >> A >> Y;
add (N,A,Y);
}
else if (In.compare ("remove") == 0)
{
cout << "Bookshelf> Select number: ";
cin >> Num;
remove (Num);
}
else if (In.compare("list") == 0)
{
list ();
}
} while (cin != "quit");
return 0;
}
void add (string N, string A, int Y)
{
if (Bookshelf[4].IsEmpty() == false)
cout << "Error!" << endl;
else
{
Bookshelf[Count] = Book (N,A,Y);
Count++;
}
cout << "Bookshelf> ";
}
The error occurs at the line add(N,A,Y); but for the life of me I can’t tell why it is saying that. They both look like std::strings to me. Can anyone explain this to me?
You have forgotten to modify your prototype at the top of your file.
It still says
It should be