TAILIEUCHUNG - C Programming for Scientists & Engineers phần 7

Chương trình 5,2 xác định hai cấu trúc, cấu trúc hình tam giác và cấu trúc file_names. Hãy nhớ rằng các báo cáo xác định các cấu trúc là các kiểu dữ liệu mới có thể được sử dụng trong báo cáo kê khai. Ngoài ra, hãy nhớ rằng những cấu trúc này được định nghĩa bên ngoài của bất kỳ chức năng, | 84 c programming for scientists and engineers limit on the user. Secondly if any value greater than 20 is stored in no -fruit information in the for loop termination expression will not be consistent with the statements that the loop controls eventually leading to an uncontrolled failure of the program. Another problem that will occur is that the user must actually count the number of fruit that they think they can name before actually naming them. This is inconvenient for the user because they essentially have to do the same job twice. Also suppose that the user elects to name 15 fruits but can then only think of 7. The or loop will not end until 15 character strings have been supplied by the for the program o continue the user must invent ome names. From this it should be dear that ahhough er loops can be used for controlling interaction with the user they are nor generally appropriate . y-ttr loops are most appropriate where a l of the information required to control the loop is known completely before the loop executes and the programmer can ensure that there will be no conflicts between the information used o control the loop and the Information urod by the statement s whin the loop as was the case in Program . Another example of this is shown in Program which prints out a table of trigonometric hmcdon values. Program - Trigonometric function display include include int main void double X pi fprintffstdout X sin x cos x tan x n for x X pi x fprintf stdout lf tf lf lf n X sin x cos x tan x return O In Program a variable X of type double is declared and then used as a counter in the òr loop. The same declaration statement initializes pi using the result of a calculation so that its value is as accurate as the precision of the double data type will allow. Prior to the for loop fprintfis Team Fl Decisions and loops 85 called so that four column titles will appear on the screen. When the for loop starts X

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.