TAILIEUCHUNG - C Programming for the Absolute Beginner phần 3

Tham khảo tài liệu 'c programming for the absolute beginner phần 3', 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ả | C Programming for the Absolute Beginner Second Edition How the pseudo code is written is ultimately up to you but you should always try to keep it as language independent as possible. Here s another problem statement that requires the use of decision-making. Allow a customer to deposit or withdraw money from a bank account and if a user elects to withdraw funds ensure that sufficient monies exist. Pseudo code for this problem statement might look like the following. if action deposit Deposit funds into account else if balance withdraw amount Insufficient funds for transaction else Withdraw monies end if end if The first point of interest in the preceding pseudo code is that I have a nested condition inside a parent condition. This nested condition is said to belong to its parent condition such that the nested condition will never be evaluated unless one of the parent conditional requirements is met. In this case the action must not equal the deposit for the nested condition to be evaluated. Also notice that for each algorithm implemented with pseudo code I use a standard form of indentation to improve the readability. Take a look at the same pseudo code this time without the use of indentation. if action deposit Deposit funds into account else if balance withdraw amount Insufficient funds for transaction else Withdraw monies end if end if Chapter 3 Conditions 53 You probably already see the benefit of using indentation for readability as the preceding pseudo code is difficult to read and follow. Without indentation in your pseudo code or actual program code it is extremely difficult to pinpoint nested conditions. In the next section you will learn how to implement the same algorithms shown previously with flowcharts. Flowcharts Popular among computing analysts flowcharts use graphical symbols to depict an algorithm or program flow. In this section I ll use four common flowchart symbols to depict program flow as shown in Figure . Common Flowchart Symbols Begin .

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.