Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Tham khảo tài liệu 'thinking in c plus plu (p6)', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | 28. Create a function that takes a pointer to an array of double and a value indicating the size of that array. The function should print each element in the array. Now create an array of double and initialize each element to zero then use your function to print the array. Next use reinterpret_castto cast the starting address of your array to an unsigned char and set each byte of the array to 1 hint you ll need to use sizeof to calculate the number of bytes in a double . Now use your array-printing function to print the results. Why do you think each element was not set to the value 1.0 29. Challenging Modify FloatingAsBinary.cppo that it prints out each part of the double as a separate group of bits. You ll have to replace the calls to printBinary with your own specialized code which you can derive from printBinary in order to do this and you ll also have to look up and understand the floating-point format along with the byte ordering for your compiler this is the challenging part . 30. Create a makefile that not only compiles YourPets1.cpp and YourPets2.cppfor your particular compiler but also executes both programs as part of the default target behavior. Make sure you use suffix rules. 31. Modify StringizingExpressions.cppo that P A is conditionally ifdefed to allow the debugging code to be automatically stripped out by setting a command-line flag. You will need to consult your compiler s documentation to see how to define and undefine preprocessor values on the compiler command line. 32. Define a function that takes a double argument and returns an int. Create and initialize a pointer to this function and call the function through your pointer. 33. Declare a pointer to a function taking an int argument and returning a pointer to a function that takes a char argument and returns a float. 230 Thinking in C www. BruceEckel .com 34. Modify FunctionTable.cppo that each function returns a string instead of printing out a message and so that this value is printed .