Starting Out with C++: Early Objects (9th Edition)
Starting Out with C++: Early Objects (9th Edition)
9th Edition
ISBN: 9780134400242
Author: Tony Gaddis, Judy Walters, Godfrey Muganda
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
Exercise, maxCylinderVolume F# system function such as min or methods in the list module such as List.map are not allowed Write a function maxCylinderVolume that takes a list of floating-point tuples that represent dimensions of a cylinder and returns the volume of the cylinder that has the largest volume. Each tuple has two floating point values that are both greater than zero. The first value is the radius r and the second value is the height h. The volume of the cylinder is computed using ??2h. The value π is represented in F# with System.Math.PI. If the list is empty, return 0.0. Examples: > maxCylinderVolume [(2.1, 3.4); (4.7, 2.8); (0.9, 6.1); (3.2, 5.4)];;val it : float = 194.3137888> maxCylinderVolume [(0.33, 0.66)];;val it : float = 0.2257988304
in c
C++ Struct Pointers Help: I have a file called names.txt. Write a program that reads each line and then store the name and nickname under an individual pointer to the class Person. names.txt: Norman, Normie Justine, Jussy Richard, Dick Shelley, Shell class Person {     public:         string name;          string nickname;       Person(string name, nickname) {         this->name=name;         this->nickname = nickname;      } };   Print out each pointer's name and nickname to verify that it has been stored.
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
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage