I am trying to correct this program and keep getting that the identifiers "pop, births, and deaths are unidentified.
This program uses the Population class and calculates the death and birth rates of a city*/
#include <iostream>
#include <iomanip>
using namespace std;
class Population
{
private:
int pop;
int births;
int deaths;
int main()
{
Population Town;
int People;
int Births,
Deaths;
cout << "Enter total population: ";
cin >> People;
while (People < 1)
{ cout << "ERROR: Value has to be greater than 0. ";
cin >> People;
}
Town.setPopulation(People);
cout << "Enter annual number of births: ";
cin >> Births;
while (Births < 0)
{ cout << "ERROR: Value cannot be negative. ";
cin >> Births;
}
Town.setBirths(Births);
cout << "Enter annual number of deaths: ";
cin >> Deaths;
while (Deaths < 0)
{ cout << "ERROR: Value cannot be negative. ";
cin >> Deaths;
}
Town.setDeaths(Deaths);
1>------ Build started: Project: bland, Configuration: Debug Win32 ------
1>Build started 5/2/2014 8:28:39 PM.
1>InitializeBuildStatus:
1> Touching "Debug\bland.unsuccessfulbuild".
1>ClCompile:
1> program.cpp
1>c:\users\fgmck_000\documents\visual studio 2010\projects\bland\bland\program.cpp(26): error C2065: 'pop' : undeclared identifier
1>c:\users\fgmck_000\documents\visual studio 2010\projects\bland\bland\program.cpp(34): error C2653: 'Pop' : is not a class or namespace name
1>c:\users\fgmck_000\documents\visual studio 2010\projects\bland\bland\program.cpp(36): error C2065: 'deaths' : undeclared identifier
1>c:\users\fgmck_000\documents\visual studio 2010\projects\bland\bland\program.cpp(39): error C2653: 'Pop' : is not a class or namespace name
1>c:\users\fgmck_000\documents\visual studio 2010\projects\bland\bland\program.cpp(41): error C2065: 'population' : undeclared identifier
1>c:\users\fgmck_000\documents\visual studio 2010\projects\bland\bland\program.cpp(44): error C2653: 'Pop' : is not a class or namespace name
1>c:\users\fgmck_000\documents\visual studio 2010\projects\bland\bland\program.cpp(46): error C2065: 'births' : undeclared identifier
1>c:\users\fgmck_000\documents\visual studio 2010\projects\bland\bland\program.cpp(46): error C2065: 'population' : undeclared identifier
1>c:\users\fgmck_000\documents\visual studio 2010\projects\bland\bland\program.cpp(48): error C2653: 'Pop' : is not a class or namespace name
1>c:\users\fgmck_000\documents\visual studio 2010\projects\bland\bland\program.cpp(50): error C2065: 'deaths' : undeclared identifier
1>c:\users\fgmck_000\documents\visual studio 2010\projects\bland\bland\program.cpp(50): error C2065: 'population' : undeclared identifier
1>c:\users\fgmck_000\documents\visual studio 2010\projects\bland\bland\program.cpp(57): error C2065: 'Pop' : undeclared identifier
1>c:\users\fgmck_000\documents\visual studio 2010\projects\bland\bland\program.cpp(57): error C2146: syntax error : missing ';' before identifier 'myTown'
1>c:\users\fgmck_000\documents\visual studio 2010\projects\bland\bland\program.cpp(57): error C2065: 'myTown' : undeclared identifier
1>c:\users\fgmck_000\documents\visual studio 2010\projects\bland\bland\program.cpp(69): error C2065: 'myTown' : undeclared identifier
1>c:\users\fgmck_000\documents\visual studio 2010\projects\bland\bland\program.cpp(69): error C2228: left of '.setPopulation' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\fgmck_000\documents\visual studio 2010\projects\bland\bland\program.cpp(77): error C2065: 'myTown' : undeclared identifier
1>c:\users\fgmck_000\documents\visual studio 2010\projects\bland\bland\program.cpp(77): error C2228: left of '.setBirths' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\fgmck_000\documents\visual studio 2010\projects\bland\bland\program.cpp(85): error C2065: 'myTown' : undeclared identifier
1>c:\users\fgmck_000\documents\visual studio 2010\projects\bland\bland\program.cpp(85): error C2228: left of '.setDeaths' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\fgmck_000\documents\visual studio 2010\projects\bland\bland\program.cpp(90): error C2065: 'myTown' : undeclared identifier
1>c:\users\fgmck_000\documents\visual studio 2010\projects\bland\bland\program.cpp(90): error C2228: left of '.getPopulation' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\fgmck_000\documents\visual studio 2010\projects\bland\bland\program.cpp(91): error C2065: 'myTown' : undeclared identifier
1>c:\users\fgmck_000\documents\visual studio 2010\projects\bland\bland\program.cpp(91): error C2228: left of '.getBirthRate' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\fgmck_000\documents\visual studio 2010\projects\bland\bland\program.cpp(92): error C2065: 'myTown' : undeclared identifier
1>c:\users\fgmck_000\documents\visual studio 2010\projects\bland\bland\program.cpp(92): error C2228: left of '.getDeathRate' must have class/struct/union
1> type is ''unknown-type''