In the class, I gave the sample code to get the cube root of a number by using BISECTION SEARCH. There are different ranges of numbers we have to handle, for example: number > 1; number < -1; 0< number < 1.
The first home assignment is to develop a software:
1. how many numbers the user wants to get the cube roots.
2. ask the user to input the numbers.
3. According to the range of number, using BISECTION search to get the cub root for each input number.
For Example:
The input :
Please input how many numbers you want to get the cube roots? 4
The number 1 is: 177
The number 2 is: 0.35
The number 3 is: -0.66
The number 4 is: -211
The output:
177 is: 5.614679574966431 (21 guesses)
0.35 is: 0.7046752929687501 (11 guesses)
0.66 is: -0.870673828125 (1
Cube root of -211 is: -5.95335054397583 (20 guesses)