Processing math: 100%

CPSC170A
Fundamentals of Computer Science II

Lab 16

Review

Titius-Bode

Write the C++ function titius_bode(int i) that uses recursion to compute the value di in the sequence defined by the following equations:

b1=1 b2=3 bi=bi12 di=4+bi10


Circle Struct

Create a C++ structure Circle that represents a two-dimensional circle. The structure should have functions to support the following usage:

Circle circle(3.0);
std::cout << "area of circle with radius 3 is " << circle.area() << std::endl;