TAILIEUCHUNG - C for Dummies 2nd edition phần 9

Các công cụ máy xay thịt. Chức năng rằng funct. Chương này giải thích làm thế nào chức năng có thể được sử dụng để thao tác hoặc sản xuất thông tin. Nó được thực hiện bằng cách gửi một giá trị đến một chức năng hoặc có một chức năng trả về một giá trị. Chương này giải thích tất cả những thứ kooky hoạt động như thế nào. | 316 Part IV C Level__ include include int main double lights lights pow 2 8 figure 2 to the 8th power printfCMilton we need lights. n lights return 0 Type this silly program on a new screen in your editor. Save the contraption to disk as . Compile and run. If you get a linker error in your Unix-like operating system please refer to the following sidebar Gotta link in that math library Here s the output Milton we need 256 lights. There. Now you both know how many lights are needed. The computer successfully concluded that 28 is equal to 256. Two to the eighth power is written out longways thus 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 The pow function expects to deal with double variables. In fact many of the functions deal with anything except integers. Constant values such as 2 and 8 inside don t have to be doubles or even typecast as doubles . Thankfully the compiler is pretty smart about that stuff. The printf placeholder used for printing a floating-point number is f. It works for both floats and doubles. The 0. part of tells printf to format the floating-point output using only the part of the number on the left of the decimal. Some languages and spreadsheets use the caret symbol A for power as in 2A8 for 28. This technique doesn t work in C. The A in C is a bitwise exclusive OR l ogical operation whatever that means. Chapter 25 Math Madness 317 Gotta link in that math library If you re using Unix Linux or Mac OS X you need to know that GCC isn t normally configured to do high-level math functions such as pow and sqrt . The reason is that the standard C library doesn t come with those math functions in it. The advantage is that programs produced with the standard library are small. The disadvantage is that you need to remember to link in the math library when you write programs that use math. The standard math library in C is named libm but you can link it into

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.