We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Lost in program

mocca23
mocca23 asked
on
Medium Priority
354 Views
Last Modified: 2010-04-17
Hi,
 Please, can someone help me with this program? I am totally lost.

This program should have three functions.

Function1 (FillPerson) should ask user to enter all the name and birthday information. Prototype for this function1 is: person FillPerson();

Function2 called WritePerson should write out all the person information using the name of the month (as opposed to the integer value) for the birthday month. The prototype for this function2 is: void WritePerson(Person);

Program should have two Person variables. It should fill these two variables and then call a function called WhoIsOlder. Function3 determines who is older and writes the age status to the screen.
The program is:

#include <iostream.h>

struct Date
{
      int month;
      int day;
      int year;
};

struct Person
{
      char name[40];
      Date birthday;
};

Person FillPerson();
void WritePerson(Person);
int WhoIsOlder(int p1, int p2);
 
int main
{
      Person MyPerson[2];
      Date insert;
      MyPerson = FillPerson();
      return 0;
}

person FillPerson()
{
      
      cout << "\n Enter the person's name:    ";
      cin.getline(MyPerson[0].name,40);
      cout << "\n Enter the person's date of birth:   ";
      cin >> insert[0].month >> insert[0].day >> insert[0].year;
      cin.ignore(10,'\n');
      return (0);
}

void WritePerson(person)
{
      cout << "\n Name of the person is << "MyPersons[0].name << 
      ",and date of birth is "  << insert[0].month << 
      insert[0].day << insert[0].year<< endl;
      cout << "\n The older person is  "<< MyPerson;
      return 0;
}

int WhoIsOlder( int p1, int p2);
{
      if (p1 > p2)  
            {
                  return (p1);
            }
      else (p1 < p2);    
            {
                  return (p2);
            }
}      

Anything would help.      
Thank you,
mocca23
Comment
Watch Question

Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
PerryDK,
Thank you so much for your help. It was very professional. This is what I wanted.

mocca23
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.