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
How to develop a C program that receives the message sent by the provided program and displays the name and email included in the message on the screen?Here is the code of the program that sends the message for reference: typedef struct {    long tipo;    struct {        char nome[50];        char email[40];    } dados;} MsgStruct; int main() {    int msg_id, status;    msg_id = msgget(1000, 0600 | IPC_CREAT);    exit_on_error(msg_id, "Creation/Connection");    MsgStruct msg;    msg.tipo = 5;    strcpy(msg.dados.nome, "Pedro Silva");    strcpy(msg.dados.email, "pedro@sapo.pt");    status = msgsnd(msg_id, &msg, sizeof(msg.dados), 0);    exit_on_error(status, "Send");    printf("Message sent!\n");}
9. Let L₁=L(ab*aa), L₂=L(a*bba*). Find a regular expression for (L₁ UL2)*L2. 10. Show that the language is not regular. L= {a":n≥1} 11. Show a derivation tree for the string aabbbb with the grammar S→ABλ, A→aB, B→Sb. Give a verbal description of the language generated by this grammar.
14. Show that the language L= {wna (w) < Nь (w) < Nc (w)} is not context free.
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
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT