You are here:

C++/Help! Create a Person.h header file


Borland C++ 5.02
I am trying to create a header file, "Person.h",
which will hold a class description and implementation (i.e. both within the header file) as follows.
The class is called Person, and has two attributes - name and year of birth.
This needs to be created by a user defined constructor method which can be used to set these attributes, using parameters which are passed when an object of the class is created.
Add two other methods which will write out
1. The persons name
2. The approximate age in any specified year, which is passed as a parameter to the method.

I need assistance to write a short test program which will create an object of the class, setting the attributes as described above, and which then calls the methods, writing the result of each out onto the screen.

I have made a genuine attempt to create this program, but failed and was told it was not what they wanted. The problem I am having is trying to understand the code and
when an error message appears when running the program.

cout<< "Hello "<<mybuffer<<".\n";
cout<< "What is your date of birth? ";
cin.getline (mybuffer,100);
cout<< "How old are you? ";
cin.getline (mybuffer,100);
cout<< "Thank you for your assistance";
cin.getline (mybuffer,100);
cout<< "Thank you "<<mybuffer<<".\n";
cout<< "You have entered: ";

I would be extremely grateful if you could get back to me soon as possible.

Wayne , Thank you for your question.

It is against my policy to do homework questions. I can help you with work that you have already done, but I cannot give you full answers.

Please attempt to do part of the work, and then ask a specific question when you get stuck.

Learning can be difficult, but doing your own work will repay your effort with good grades in school and success in your career.

David Spector


All Answers

Answers by Expert:

Ask Experts


David Spector


Highly knowledgeable in the C++ language, Visual C++ (MSVC), Windows API, documentation and other quality-assurance techniques, and debugging. Knowledgeable in MFC, COM, GUI design, and object-oriented design.


I have been a software engineer since 1965. I have been published. My specializations have been: biomedical programming, compiler implementation, and many kinds of Windows programming. I don't do Databases or other business-oriented stuff.

Windows?/DOS Developer's Journal, ACM SIGPLAN Notices, and Computer Science Press.

ICCP Systems Programming Certification
Master's degree equivalent in Computer Science

©2017 All rights reserved.