Problem Solving with C++ plus MyProgrammingLab with Pearson eText-- Access Card Package (9th Edition)
Problem Solving with C++ plus MyProgrammingLab with Pearson eText-- Access Card Package (9th Edition)
9th Edition
ISBN: 9780133862218
Author: Walter Savitch
Publisher: PEARSON
bartleby

Concept explainers

Expert Solution & Answer
Book Icon
Chapter 18.3, Problem 19STE

Explanation of Solution

Modified code:

The modified code for given display 18.17 is shown below:

//Header file

#include <iostream>

#include <list>

#include <algorithm>

//std namespace

using std::cin;

using std::cout;

using std::endl;

using std::list;

using std::find;

//Min function

int main( )

{

        /* Declare line in "list" template */

        list<char> line;

        /* Display prompt statement */

    cout << "Enter a line of text:\n";

        //Declare variable for "next"

        char next;

    /* Read text from user */

        cin.get(next);

        /* If "next" is not equal to "\n" */

        while (next != '\n')

        {

            /* Insert the character to list */

            line.push_back(next);

            /* Read the next character */

            cin.get(next);

        }

  /* Declare char varaible "where" in constant iterator */

        list<char>::const_iterator where;

  /* where is located at the first occurrence of 'e' in line.*/

        where = find(line.begin( ), line.end( ), 'e');

  /* Declare char variable "p" in constant iterator */

    list<char>::const_iterator p;

        /* Display statement */

  cout << "You entered the following before you entered your first e:\n";

  /* Using "for" loop, display located at the first occurrence of 'e' in line */

        for (p = line...

Blurred answer
Students have asked these similar questions
Pllleasassseee ssiiirrrr soolveee thissssss questionnnnnnn
4. def modify_data(x, my_list): X = X + 1 my_list.append(x) print(f"Inside the function: x = {x}, my_list = {my_list}") num = 5 numbers = [1, 2, 3] modify_data(num, numbers) print(f"Outside the function: num = {num}, my_list = {numbers}") Classe Classe that lin Thus, A pro is ref inter Ever dict The The output: Inside the function:? Outside the function:?
python Tasks 5 • Task 1: Building a Library Management system. Write a Book class and a function to filter books by publication year. • Task 2: Create a Person class with name and age attributes, and calculate the average age of a list of people Task 3: Building a Movie Collection system. Each movie has a title, a genre, and a rating. Write a function to filter movies based on a minimum rating. ⚫ Task 4: Find Young Animals. Create an Animal class with name, species, and age attributes, and track the animals' ages to know which ones are still young. • Task 5(homework): In a store's inventory system, you want to apply discounts to products and filter those with prices above a specified amount. 27/04/1446
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
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education