Starting Out With C++, Early Objects - With Access Package
Starting Out With C++, Early Objects - With Access Package
8th Edition
ISBN: 9780133441840
Author: GADDIS
Publisher: PEARSON
bartleby

Concept explainers

Question
Book Icon
Chapter 19, Problem 9PC
Program Plan Intro

Cousins

Program Plan:

  • Include all the required header files.
  • Add enum for a range of values of Gender.
  • Define class person.
    • Define all the required variables along with their data types.
    • Assign the name and gender of a person using functions string getName()and Gender getGender().
    • Function to add child of a person Person *addChild is created.
    • Function to add parents of a person void addParent is created.
    • Function to get number of children of a person and return the number of children is created.
    • Function to create a child with specified name and gender, and set one of the parents to this child Person *Person::addChild is called.
    • Function to add siblings and step siblings of a given person to a vector void addSiblings is created.
    • Function to add cousins of the person void addCousins is called.
  • Define the main function.
    • Add children of Adam and Amelia.
    • Add Children of Amelia and Alan.
    • Add Children of Alan and Anna.
    • Add cousins from third generations.
    • Find the cousins of at least two people, here consider Peter and Paul and find their cousins and display them.

Blurred answer
Students have asked these similar questions
Write a struct ‘Student’ that has member variables: (string) first name, (int) age and (double) fee. Create a sorted (in ascending order according to the age) linked list of three instances of the struct Student. The age of the students must be 21, 24 and 27. Write a function to insert the new instances (elements of the linked list), and insert three instance whose member variable have age (i) 20, (ii) 23 and (iii) 29. Write a function to remove the instances from the linked list, and remove the instances whose member variables have age (i) 21 and (ii) 29. Write a function to count the elements of the linked list. Write a function to search the elements from the linked list, and implement the function to search an element whose age is 23. Write a function to print the linked list on the console. Consider the Student struct as defined above. Create a stack of 5objects of the class. Implement the following (i) push an element to the stack (ii) pop an element from the stack (iii) get the…
In C++ Define a structure called Date with month, day and year as its only integer members. Define a structure called Person with name (string) and birthDate (Date) as its only members. Define a ValidDate() function to retrun true if a Date passed to it is a valid date and false if not. Define a LeapYear() function that returns true if a year passed to it is a leap year and false if not. Define a ShowList() function that takes an array of Persons and its size and displays all its members' names and birthdates. Define a sort() function that takes an array of Persons and size and sorts the array based on their names in ascending order. Write a main() program where you declare an array of Person structures of maximum size 50, read as many Persons from the user as the user wants to enter and then display the list. Then, sort the list and display again. The user will hit the Enter key without typing anything else for the name when done. For example, if the input is the following: Robert…
Write C code that implements a soccer team as a linked list. 1. Each node in the linkedlist should be a member of the team and should contain the following information: What position they play whether they are the captain or not Their pay 2. Write a function that adds a new members  to this linkedlist at the end of the list.
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning