✍️ Get Writing Help
WhatsApp

The cylinder

What is the output of the following C++ code? (2, 3)

double dec1 = 2.5;

double dec2 = 3.8;

double *p, *q;

p = &dec1;

 *p = dec2 – dec1;

q = p;

*q = 10.0;

*p = 2 * dec1 + (*q);

q = &dec2;

dec1 = *p + *q;

cout < dec1=””>< “=”” “=””>< dec2=””>< endl;=””>

cout < *p=””>< “=”” “=””>< *q=””><>

The following code should output the radius of the base, height, volume, and surface area of a cylinder. However, it fails to do so. Correct this code to accomplish the desired results. After correcting the code, what is the output? Do not alter the values assigned to the radius of the base and the height of the cylinder.  (2, 3, 6)

double *baseRadius;

double *height;

cout < fixed=””>< showpoint=””><>

baseRadius = new double;

 *baseRadius = 1.5;

height = new double;

*height = 2 * (*baseRadius);

baseRadius = new double;

*baseRadius = 4.0;

cout < “radius=”” of=”” the=”” base:=”” “=””>< baseradius=””>< endl;=””>

cout < “height:=”” “=””>< height=””>< endl;=””>

cout < “volume:=”” “=””>< 3.14=”” *=”” (baseradius)=”” *=””>

     < endl;=””>

cout < “surface=”” area:=””>

     < 2=”” *=”” 3.14=”” *=”” (baseradius)=”” *=”” (height)=””><>

For faster services, inquiry about  new assignments submission or  follow ups on your assignments please text us/call us on +1 (251) 265-5102