Starting Out with C++: Early Objects
Starting Out with C++: Early Objects
8th Edition
ISBN: 9780133360929
Author: Tony Gaddis, Judy Walters, Godfrey Muganda
Publisher: Addison-Wesley
bartleby

Concept explainers

Question
Book Icon
Chapter 14, Problem 11PC
Program Plan Intro

Ancestral Trees

Program Plan:

  • Include required header files.
  • Declare and initialize string arrays “people []”, “mother []”, and “father []”.
  • Declare and initialize positions for the integer arrays “mom []”, and “pop []”.
  • Give function prototype “ancestors ()”.
  • Given function definition for “ancestors ()”.
    • Print the name of the person.
    • Check if mom’s position is not equal to -1.
      • Call the function ““ancestors ()”.
    • Check if pop’s position is not equal to -1.
      • Call the function ““ancestors ()”.
  • Define the function “main ()”. Inside this function,
    • Print the ancestors of the person containing index “0” from “people []” array by calling the function “ancestors ()” by passing “0” as the argument.
    • Print the ancestors of the person containing index “6” from “people []” array by calling the function “ancestors ()” by passing “6” as the argument.
    • Return the statement.

Blurred answer
Students have asked these similar questions
C programming I need a code that asks the user for how many times it'll run and run that many time and ask the user for a number and it puts that number into a binary search tree and an array using diffrent functions
C++ Binary Search Tree program Create a class "Person" with three member variables string first name, string last name, int age. The primary key will be the last name. User will be prompted with a menu with two options: 1, "Enter person", where they will enter the persons first name, last name and age, or 2, "View person list" where the person may view the information previously added.
C++ Queue LinkedList, Refer to the codes I've made as a guide and add functions where it can add/insert/remove function to get the output of the program, refer to the image as an example of input & output. Put a comment or explain how the program works/flow.
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++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage