This is my current coding, in my header file
#ifndef _ADDRESSBOOK
#define _ADDRESSBOOK
const int MAXADDRESS = 25;
struct PERSON
{
char fName[25];
char lname[25];
char Address[100];
};
class addressBook
{
private:
PERSON people[10];
public:
addressBook();
addressBook(char *fName, char*lname, char *add);
addressBook(PERSON a);
addressBook(PERSON init[], int count);
bool addPerson(const PERSON &p);
bool getPerson(PERSON &p);
bool findPerson(char *lastName, PERSON &p);
bool findPerson(char *lastName, char *firstName, PERSON &p);
void bubbleSort();
void printBook();
};
#endif
I have to change this the
private:
PERSON people[10];
to a vector, so I tried declaring it like this
vector <PERSON> people;
but i keep getting error messages saying stuff like this
1>e:\c++ level 2\address book\address book\addressbook.h(17) : error C2143: syntax error : missing ';' before '<'
1>e:\c++ level 2\address book\address book\addressbook.h(17) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>e:\c++ level 2\address book\address book\addressbook.h(17) : error C2238: unexpected token(s) preceding ';'
1>e:\c++ level 2\address book\address book\addressbook.cpp(20) : error C2065: 'people' : undeclared identifier
but that was how my teacher showed me I declare a vector. well actually, he showed me while using "vector <int> x;" but he said that I could use a struct as a base type..I think. Can anybody tell me why I'm getting these errors?