TAILIEUCHUNG - THEORY AND PROBLEMS OF PROGRAMMING WITH Second Edition phần 3

Mỗi bước xuất hiện rất đơn giản khi nhìn từ phía trên. Tuy nhiên, một số bước yêu cầu chi tiết hơn trước khi họ thực sự có thể được lập trình. Ví dụ, dữ liệu đầu vào bước sẽ được thực hiện tương tác. Điều này sẽ đòi hỏi một số hộp thoại được tạo ra bởi cặp báo cáo printf và scanf, như được giải thích trong các Chap. | 102 PREPARING AND RUNNING A COMPLETE c PROGRAM CHAP. 5 4. Determine the future accumulation F using the formula F P 1 0 5. Display the calculated value for F. Here is the program outline in the form of pseudocode. compound interest calculations main declare the program variables read in values for p r and n calculate a value for i calculate a value for F display the calculated value for F Each of these steps appears very simple when viewed from the top. However some steps require more detail before they can actually be programmed. For example the data input step will be carried out interactively. This will require some dialog generated by pairs of printf and scanf statements as explained in the Chap. 4. Moreover c does not have an exponentiation operator. Therefore some additional detail will be required in order to evaluate the formula F P 1 i n Here is a more detailed version of the above outline. compound interest calculations main declare p r n i and f to be floating-point variables write a prompt for p and then read in its value write a prompt for r and then read in its value write a prompt for n and then read in its value calculate i r 100 calculate f p 1 i n as follows f p pow 1 i n where pow is a library function for exponentiation display the value for f with an accompanying label This outline involves more detail than is actually necessary for a program this simple though it does illustrate the topdown approach to program development. We will consider the detailed development and implementation of this program later in this chapter in Examples and . Another method that is sometimes used when planning a c program is the bottom-up approach. This method may be useful for programs that make use of self-contained program modules . user-defined functions . The bottom-up approach involves the detailed development of these program modules early in the planning process. The overall program development is then based upon the known characteristics of .

TÀI LIỆU MỚI ĐĂNG
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.