C++ PROGRAMMING:FROM...(LL) >CUSTOM<
C++ PROGRAMMING:FROM...(LL) >CUSTOM<
8th Edition
ISBN: 9780357019528
Author: Malik
Publisher: CENGAGE C
Expert Solution & Answer
Book Icon
Chapter 12, Problem 13SA

Explanation of Solution

The program execution is explained in the in-lined comments:

#include <iostream> 

#include <iomanip>

using namespace std; 

int main()  

{  

    //declare pointer variables and allocate memory

    double *trip1Cost = new double;

    double *trip2Cost = new double;

    double *trip3Cost = new double;

    double *max;

    //store values in the allocated memory 

    *trip1Cost = 100.00;

    *trip2Cost = 350.00;

    //assign pointer variables to each other

    //trip3Cost now points to location having 

    //stored 350.00 later trip2Cost points

    //to location having a stored value 100.00

    trip3Cost = trip2Cost;

    trip2Cost = trip1Cost;

    //trip1Cost is now pointed to freshly allocated

    //memory location and assigned value

    trip1Cost = new double;

    //trip1Cost points to a location having

    //stored value of 175 and trip3Cost now

    //points to a location having a stored value 275

    *trip1Cost = 175;

    *trip3Cost = 275;

    //sets the output format

    cout << fixed << showpoint << setprecision(2);

    //prints the arithmetic expression

    //(*trip1Cost + *trip2Cost + *trip3Cost) which

    //evaluates to (175 + 100...

Blurred answer
Students have asked these similar questions
C++ Write a program that takes as input an arithmetic expression followed by a semicolon ;. The program outputs whether the expression contains matching grouping symbols. For example, the arithmetic expressions {25 + (3 – 6) * 8} and 7 + 8 * 2 contains matching grouping symbols. However, the expression 5 + {(13 + 7) / 8 - 2 * 9 does not contain matching grouping symbols. If the expression contains matching grouping symbols, the program output should contain the following text: Expression has matching grouping symbol If the expression does not contain matching grouping symbols, the program output should contain the following text: Expression does not have matching grouping symbols.
In c++
C++
Knowledge Booster
Background pattern image
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