Im trying to learn c++ and i got a book which is not that great in my opinion, due to errors.
one of my problems im having with one of the exercises is trying to set values for food, land.
every time i run the program i get a bunch of errors all stating that everything in the nation method cannot be
used as a function. how can i initialize or set them to the values so it works. thanks in advance. I am
including the class i have and the method where the errors keep appearing.
I also have what i think should work if anyone wants or needs to see more of the code i have written
The code you can download with the book is useless in my opinion because it gives more errors than when i write it
from scratch.
class Nation
{
public:
int land;
int troops;
Nation(string lName);
Nation();
bool takeTurn();
private:
void menu();
string name;
int food, gold, people, farmers, merchants, blacksmiths;
};
Nation nation1;
Nation nation2;
Nation::Nation(string lName)
{
name(lName), land(20), food(50), troops(15), gold(100),
people(100), farmers(0), merchants(0), blacksmiths(0);
}