You are trying to assign an int to a string. So why do you wonder that the compiler issued an error?!
dependents = atoi(dependents.c_str());
Also better than atoi - atod there are "strtol" for integers and "strtod" for decimals. They have error checking, so using them is safer.
http://www.cplusplus.com/reference/cstdlib/strtol
http://www.cplusplus.com/reference/cstdlib/strtod
Last edited on