// Creates and manipulates a person with a first name, last name and age

closed account (E0MoLyTq)
Why am I getting the error of the argument has not been declared
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#include <iostream>
#include <string>
#include "Person.h"
#include <cassert>

using namespace std;

// CONSTRUCTORS
/*!
 *  @function   Person constructor, 0 to 3 arguments
 *  @param      string fname - first name for new person
 *  @param      string lname - last name for new person
 *  @param      int A - age for new person
 *  @pre        A >= 0, fname.size() >= 1, lname.size() >= 1
 *  @return     a new Person, initialized with provided data
 */                                   
Person::Person(string fname, string lname, int A)
{
   assert(A >= 0);
   setAge(A);
   assert(fname.size() >= 1);
   setFirstName(fname);
   assert(lname.size() >= 1);
   setLastName(lname);
}
// MODIFICATION MEMBER FUNCTIONS
/*!
 *  @function   setFirstName
 *  @param      string newName, the new first name
 *  @pre        newName.size() >= 1
 *  @post       the Person's first name data is updated
 */
void Person::setFirstName(string newName)
{
   assert(newName.size() >= 1);
   fname = newName;

}

/*!
 *  @function   setLastName
 *  @param      string newName, the new last name
 *  @pre        newName.size() >= 1
 *  @post       the Person's last name data is updated
 */
void Person::setLastName(string newName)
{
   assert(newName.size() >= 1);
   lname = newName;
}

/*!
 *  @function   setAge
 *  @param      int newAge, the new age value
 *  @pre        newAge >= 0
 *  @post       the Person's age data is updated
 */
void Person::setAge(int newAge)
{
   assert(newAge >= 0);
   newAge = A;  // stub; does nothing
}

/*!
 *  @function   agePerson
 *  @post       the Person's age is increased by 1
 */
void Person::agePerson()
{
   // stub; does nothing
}

// // ACCESSOR MEMBER FUNCTIONS
/*!
 *  @function   getFirstName
 *  @return     the Person's first name
 */
string Person::getFirstName() const{
   // stub
   return fname;
}

/*!
 *  @function   getLastName
 *  @return     the Person's last name
 */
string Person::getLastName() const{
   // stub
   return lname;
}

/*!
 *  @function   getAge
 *  @return     the Person's age
 */
int Person::getAge() const
{
 // stub
   return A;
}
Please post the EXACT text of the error message you're getting.

You haven't posted person.h, so I can't compile this to duplicate your problem.
Topic archived. No new replies allowed.