STARTING OUT WITH C++ MPL
STARTING OUT WITH C++ MPL
9th Edition
ISBN: 9780136673989
Author: GADDIS
Publisher: PEARSON
Question
Book Icon
Chapter 16, Problem 10PC
Program Plan Intro

Two Dimensional Data

Program Plan:

  • Include the required header files.
  • Define the function getData(),
    • Declare and initialize the variable.
    • Loop executes until k is less than number. If yes,
      • Read the index of the tourists from file.
      • Store the tourists name into vector.
    • Loop executes until k is less than number. If yes,
      • Read the index of the tourists from file.
      • Loop executes until j is less than numberDestinations. If yes,
        • Read the destination from the file.
        • Add the favorite destination for each person.
      • Store the favorite destination for each person into another vector.
  • Define the function indexOf(),
    • Loop executes until the k is less than size of vector. If yes,
      • Check whether the name is equal to vector name. If yes,
        • Return the k value.
    • Exit the function
  • Define the “main()” function.
    • Create object to open the file.
    • Check for file existence. If yes,
      • Display the file status.
    • Declare the two vectors.
    • Call getData() function retrieves data from the file and stores it into two vectors.
    • Loop executes until k is size of tourists. If yes,
      • Display the names of tourists
    • Display the statement.
    • Loop executes until true. If yes,
      • Read the name of the tourist from user.
    • Check name is equal to quit. If yes, exit the program.
    • Call the indexOf() function returns the index of a string in a vector of strings.
    • Check the index is equal to -1. If yes,
      • Display the statement.
      • Continue the program.
    • Loop executes until the end of the vector. If yes,
      • Display the statement.
      • Increment iteration by 1.

Blurred answer
Students have asked these similar questions
Problem: • Assume that we have a matrix that stored inside a file and it contains monthly salary of each employee of a company. The matrix column starts from month 1 to 12, and for the rows you can enter data for 6 employees minimum. • The output of the program must be the annual salary of each employee of the company.
#The Iris Dataset import sklearn.datasetsimport matplotlib.pyplot as plt import numpy as np import scipy iris = sklearn.datasets.load_iris() Write a function that takes in an index i and prints out a verbose desciption of the species and measurements for data point i. For example:Data point 5 is of the species setosaIts sepal length (cm) is 5.4Its sepal width (cm) is 3.9Its petal length (cm) is 1.7Its petal width (cm) is 0.4
Computer Science (PYTHON) Once a transaction completes, update the quantity on hand for each item sold to a customer in the dictionary: Quantity = {101:2,102:5,103:8,104:2,105:8,106:4,107:6,108:3,109:2,110:10}

Chapter 16 Solutions

STARTING OUT WITH C++ MPL

Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning