Read the code below and answer the following questions doubl

Read the code below and answer the following questions: double y = 100; double *ptr = &y; int x = 7; Int *iptr = &x; Write a cout statement that uses the ptr variable to display the contents of the y variable. What will be displayed if you send the expression *iptr to cout? What happens if you send the expression iptr to cout? Assuming that soap is an instance of the the Inventory class, which of the following below is a valid call to the setOnHand member function. setonHand (20); soap::setOnHand (20); soap.setOnHand (20); Inventory.setOnHand (20); The following program contains errors. Find as many as possible. class circle: { private double centerX; double center; double radius; public SetCenter (double, double); setRadius (double); }

Solution

a) cout<< ptr;

b) it will print 7;

c) cout<<iptr; will result in print of address of x in hexadecimal;

d) D) soap.setOnHand(20);

e)

erros;

correct example;

class circle

{

private:

double centerX;

double center;

double radius;

public:

void SetCenter(double,double);

void setRadius(double);

};

 Read the code below and answer the following questions: double y = 100; double *ptr = &y; int x = 7; Int *iptr = &x; Write a cout statement that uses t

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site