C++ Programming: From Problem Analysis to Program Design
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN: 9781337102087
Author: D. S. Malik
Publisher: Cengage Learning
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
We are considering the RSA encryption scheme. The involved numbers are small, so the communication is insecure.  Alice's public key (n,public_key) is (247,7). A code breaker manages to factories  247 = 13 x 19  Determine Alice's secret key. To solve the problem, you need not use the extended Euclid algorithm, but you may assume that her private key is one of the following numbers 31,35,55,59,77,89.
Consider the following Turing Machine (TM). Does the TM halt if it begins on the empty tape? If it halts, after how many steps? Does the TM halt if it begins on a tape that contains a single letter A followed by blanks? Justify your answer.
Pllleasassseee ssiiirrrr soolveee thissssss questionnnnnnn
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