UCO Write a Program Initializing an Array with Ten Integers Project – Description

E5.2 Write a c++ function that computes the balance of a bank account with a given initial balance and interest rate, after a given number of years. Assume interest is compounded yearly.

E5.6 Write a c++ functionΒ 

String middle(string str)

that returns a string containing the middle character in str if the length of the str is odd, or the two middle characters if the length is even. For example, middle(β€œmiddle”) returns β€œdd”.

E5.11 Write functions

double sphere_volume(double r)

double sphere_surface(double r)

double cylinder_volume(double r, double h)

double cylinder_surface(double r, double h)

double cone_volume(double r, double h)

double cone_surface(double r, double h)

that compute the volume and surface area of a sphere with radius r, a cylinder with a circular base with radius r and height h, and a cone with a circular base with radius r and height h. Then write a program that prompts the user for the values of r and h, calls the six functions, and prints the results.Β 

E5.14 Write a c++ function void sort2(int& a, int& b) that swaps the values of a and b if a is greater than b and otherwise leaves a and b unchanged. For example,

int u = 2;

int v = 3;

int w = 4;

int x =1;

sort2(u, v); // u is still 2, v is still 3

sort2(w, v); // w is now 1, x is now 4

E5.17 Implement the number_to_grade function of Worked Example 5.3, so that you use two sets of branches: one to determine whether the grade should be A,B,C,D, or F, and another to determine where a+ or – should be appended.

E5.18 Write a c++ program that prints instructions to get coffee, asking the user for input whenever a decision needs to be made. Decompose each task into a function, for example:

Void brew_coffee()

{

cout

The post UCO Write a Program Initializing an Array with Ten Integers Project first appeared on .