Difference between revisions of "CSC231 Homework 3 Solution"
(New page: Answers provided by D. Thiebaut =Problem 1= Here is the original program: <code><pre> /* mystery.cpp // D. T. // mystery program // To compile and run this program: /...) |
|||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | <onlydft> | ||
Answers provided by D. Thiebaut | Answers provided by D. Thiebaut | ||
=Problem 1= | =Problem 1= | ||
Line 42: | Line 43: | ||
=Problem 2= | =Problem 2= | ||
− | I simply created a spreadsheet with several column, as shown [[CSC103_Fibonacci_storage.pdf | here]]. | + | I simply created a spreadsheet with several column, as shown [[Media:CSC103_Fibonacci_storage.pdf | here]]. |
The column labeled "Bytes" for example, has a formula of the type '''=if( Bxx<=2^8, 1, 0 )''', which compares the Fibonacci term on the same row, in Column B, and if it is less than 2 to the 8th power, writes a 1 (good) in the column, else 0 (byte-storage too small). A similar formula is used in the word column, but this time with 2^16, in the dword column, with 2^32, and in the qword (quad word) column, with 2^64. | The column labeled "Bytes" for example, has a formula of the type '''=if( Bxx<=2^8, 1, 0 )''', which compares the Fibonacci term on the same row, in Column B, and if it is less than 2 to the 8th power, writes a 1 (good) in the column, else 0 (byte-storage too small). A similar formula is used in the word column, but this time with 2^16, in the dword column, with 2^32, and in the qword (quad word) column, with 2^64. | ||
Line 72: | Line 73: | ||
The last number displayed is 2^31. | The last number displayed is 2^31. | ||
+ | |||
+ | </onlydft> |