Homework 19

 

Assuming the following declarations and initializations and prototypes:

double w = 0.25, u = 0.36;
int i=7;

// sqrt(x) is just like cmath's sqrt
double sqrt(double x);

// sqrt(k) returns true if the SQUARE ROOT of k is a positive integer, false otherwise
bool sqrt(int k);

// round(x) returns integer nearest x
int round(double x);

 Note: sqrt() is overloaded.  Which sqrt function is called depends on the data type of the argument (here, double or int) passed to it as an argument.

Fill in the following table, giving the type and value of each expression.

Expression

Type

Value

sqrt(w)

 

 

sqrt(-9)

 

 

round(sqrt(u))

 

 

sqrt(5) || (i <2)

 

 

 

Turn in the table with the types and values filled in.