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
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
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,