DeVry COMP 122 Week 5 Homework Latest

$25

Description

DeVry COMP 122 Week 5 Homework Latest

Week 5 Homework

Complete the following problems.

  1. 1.Determine the value of the following expressions.
  2. a.toupper(‘b’)
  3. b.tolower(‘C’);
  4. c.pow(3.0,3.0);
  5. d.sqrt(81.0);
  6. e.fabs(-1.23);
  7. f.floor(22.46);
  8. g.ceil(33.3);
  9. 2.Using the functions in the cmath library, write the following mathematical formulas as C expressions.
  10. a.3.02.4
  11. b.(x – y)1/2Note: the ½ power is the square root
  12. c.|y – 42.3|

d.( -b (b2 – 4ac)1/2) / 2a

  1. 3.Consider the following functions:

int func1(int x)

{

int r, s;

r = 2 * x;

if (r > 10)
{

s = x / 2;

}

else
{

s = x / 3;
}

return s – 2;

}

int func2(int a, int b)

{

int r, s;

s = 0;

for(r = a; r < b; r )

{

s ;

}

return s;

}

What is the output from the following program fragments?

int a, b;

  1. a.a = 10;
    cout << func1(a) << endl;
  2. b.a = 5; b = 12;

cout << func2(a, b) << endl;
c. a = 8;

b = func1(a);

cout << a << ” ” << b << ” ” << func2(a, b) << endl;

  1. 4.Write a C function that has an input of a char value and returns true if the character is lower case or false otherwise.
  2. 5.Write a C function that has three inputs which are integers.The function returns true if the first number raised to the power of the second number equals the third number.
  3. 6.What is a function prototype? When is it needed?
  4. 7.What is the difference between an actual parameter and a formal parameter?
  5. 8.Explain the difference between pass by value parameters and pass by reference parameters.
  6. 9.Explain the difference between function parameters, local variables, and global variables regarding the parts of a program that can access these values.
  7. 10.What does voidsignify when used as the return type of a function?
  8. 11.What is the output of the following program fragment:

void find(int a, int& b, int& c)
{
int temp;

c = a b;

temp = a;

a = b;

b = 2 * temp;

}

int main()

{

int x, y, z;

x = 15;

y = 25;

z = 30;

find(x, y, z);

cout << x << ” ” << y << ” ” << z << endl;

find(y, x, z);

cout << x << ” ” << y << ” ” << z << endl;

find(z, y, x);

cout << x << ” ” << y << ” ” << z << endl;

}

  1. 12.Write a C function which initializes its three reference parameters.The function should take an int, double, and string parameter and initialize them to 0 and the empty string (“”).

 

DeVry Courses helps in providing the best essay writing service. If you need 100% original papers for DeVry COMP 122 Week 5 Homework Latest, then contact us through call or live chat.

DeVry COMP 122 Week 5 Homework Latest

Best DeVry COMP 122 Week 5 Homework Latest
DeVry COMP 122 Week 5 Homework Latest

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Back to Top