STARTING OUT WITH C++ MPL
STARTING OUT WITH C++ MPL
9th Edition
ISBN: 9780136673989
Author: GADDIS
Publisher: PEARSON
bartleby

Concept explainers

Question
Book Icon
Chapter 14, Problem 12PC
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
Subject-Object oriented programing Write a program which:• creates a new Array List• adds 5 decimal numbers to it• prints the list to the screenb) In the same program, insert an element in the above ArrayList at index 2. The resulting Array Listmust be one element larger. Print the resulting list to the screen.c) In the same program, replace the element in the ArrayList at index 2 by null. Print the resulting list tothe screen.d) In the same program, remove the element at the last index of the Array List. Print the resulting list tothe screen.e) In the same program, use a 'for' loop to print each element of the Array List to the screen.f) Create a class named ArrayListManager. Into this class, code a method which prints to the screenevery element of an Array List of strings placed at an odd index. Hint: use a modulus.
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.
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
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage