help with "sorting" input function

I am new to c++ and am having a hard time with an assignment to write program to build and display a family tree using classes to hold the data for each person and pointers to the people associated with each person.
the data input for each person includes a name with a number such as (dan1), the number should be treated seperate from the name, birthdate, marital status (M or S), if the marital status is M then a spouse name and spouse birthdate, followed by a variable for the number of children and a possible deathdate.A X will signify the end of the line/input.

sample input: Steve112Nov1931MMary117Dec1833Steve2Harry1Sue13Jan1959X
Steve231Dec1957SXavier1X

After the input of people there the word QUIT following that there will be a list of names to search the input for and then print name (birthdate) S or M if M spouse, spouse birthdate, children, their birthdates, deathdate (can only have a death date for the 1st person)


Message starred Friday, November 30, 2012 11:04 AM #include <iostream>
#include <string>

using namespace std;




class Person
{
private:
string name;
string birth;
string death;
string marstat;
Person *spouse;
Person *child;
public:
Person::Person()
{
marstat = ' ';
spouse = NULL;
child[20] = NULL;
}
string name;
string birth;
string marstat;
string child[20];
string childBirth;
string spouse;
string spouseBirth;
string death;
void setValues (Person * ttp)
{
ttp->name = name;
ttp->birth = birth;
ttp->marstat = marstat;
ttp->child = child;
ttp->spouse = spouse;
ttp->spouseBirth = spouseBirth;
ttp->death = death;
}
void askValues ();
cin >> name;
cin >> birth;
cin >> marstat;
if (marstat == "M")
{
cin>> spouse_name;
cin>> spouse_birth;
}
for (int g= 0, g < 20)
{
{
if child[g]= "NULL"
then
}
}








right now I am trying to organize my classes and make loops to sort through the input in order to know what comes next. I think I might need something the askValues function, I have been looking for tutorials but I have no idea if I'm going in the right direction. Any suggestions or corrections would be much apperciated!!

Topic archived. No new replies allowed.