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 9SA

Explanation of Solution

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

#include <iostream> 

using namespace std; 

int main()  

{  

    //declare variables dec1, dec2 and initialize

    double dec1 = 2.5;

    double dec2 = 3.8;

    //declare double pointers p and q

    double *p, *q;

    //assign the address of variable dec1 to p

    p = &dec1;

    //assign the value of dec2 - dec1 to the memory

    //location pointed to by p which is dec1

    //so dec1 now holds the value (3.8-2.5 =) 1.3

    *p = dec2 - dec1;

    //q is assigned the value of p so both the pointers

    //now point to variable dec1

    q = p;

    //content of the memory location pointed to by q

    //is assigned 10.00 so dec1 holds the value 10.0

    *q = 10.0;

    //the contents of the memory location pointed to by p

    //i.e dec1 is assigned the value of the RHS expression

    //RHS = 2 &*#x00A0;10 + 10...

Blurred answer
Students have asked these similar questions
(1 point) By dragging statements from the left column to the right column below, give a proof by induction of the following statement: an = = 9" - 1 is a solution to the recurrence relation an = 9an-18 with ao = : 0. The correct proof will use 8 of the statements below. Statements to choose from: Note that a₁ = 9a0 + 8. Now assume that P(n) is true for all n ≥ 0. Your Proof: Put chosen statements in order in this column and press the Submit Answers button. Let P(n) be the predicate, "a = 9″ – 1". απ = 90 − 1 = Note that Let P(n) be the predicate, "an 9" - 1 is a solution to the recurrence relation an = 9an-1 +8 with ao = 0." - Now assume that P(k + 1) is true. Thus P(k) is true for all k. Thus P(k+1) is true. Then ak+1 = 9ak +8, so P(k + 1) is true. = 1 − 1 = 0, as required. Then = 9k — 1. ak Now assume that P(k) is true for an arbitrary integer k ≥ 1. By the recurrence relation, we have ak+1 = ak+1 = = 9ak + 8 = 9(9k − 1) + 8 This simplifies to 9k+19+8 = 9k+1 − 1 Then 9k+1 − 1 = 9(9*…
Given the following request to an AI chatbot, which response is more accurate? (You should use Google to verify that the factual claims in each response are accurate.)   Prompt Is this true? The first recorded use of the phrase "when pigs fly" in print is in a 1616 play by Ben Jonson called "The Devil is an Ass," in which a character says, "When pigs fly, good-night!!" Response   Response A Response B Yes, that's true! The phrase "when pigs fly" indeed appears in Ben Jonson's 1616 play The Devil is an Ass and was said during the second act in a conversation between Fitzdottrel and Pug. The phrase was first used to express skepticism or disbelief, suggesting that something is as unlikely to happen as the fanciful idea of pigs flying. This usage is often cited as one of the earliest instances of the phrase in print.   The claim that the phrase "when pigs fly" was first recorded in Ben Jonson's 1616 play "The Devil is an Ass" is not accurate. There is no evidence from the…
This is for my Computer Organization & Assembly Language Class
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,