TAILIEUCHUNG - Computer Programming for Teens phần 6

bạn sẽ có được một giá trị đúng hay sai. Bây giờ chúng ta hãy khai báo một số biến boolean và sử dụng chúng trong báo cáo chuyển nhượng với những ví dụ. Bởi vì chúng ta muốn khai báo nhiều hơn một biến boolean cùng một lúc, chúng tôi sẽ làm một danh sách của các biến sau khi boolean loại. Chỉ riêng biệt các biến | 156 Chapter 9 Using Functions in Graphics Both functions have the word void in the return type position. This indicates that no values will be sent back to the calling place after the functions have been executed. So let s practice using these functions so you can see how they work. The first thing we will do is draw a huge capital letter M. We ll draw this by using the following algorithm. Algorithm for drawing an M 1. Move to the lower-left corner of the letter. 2. Draw a line straight up . 3. From that position draw a diagonal line down to the middle of the M. 4. From there draw another diagonal up to the top-right corner of the letter. 5. Draw a line straight down to finish the letter. The algorithm involves moving to where we want to position the M and then drawing the four line segments that make up the M. The difficult part about making the letter will be judging where the two diagonal lines should meet in the middle of the letter. M Find the middle of this letter. The column should be halfway between the left and right columns. Step 1. Move to 45 10 position. Step 2. Draw a line up to 25 10. That means that our line is 20 units long. That is it stretches from row 45 up to row 25. Remember we are moving in a direction as we draw this letter. We are trying to draw in sequence and not just any way that we want. Otherwise we would constantly have to reposition ourselves by calling the MoveTo function. Step 3. Draw a diagonal line down to row 40 not as deep as 45 and at column 30. Step 4. Draw a diagonal line up to row 25 same height as left vertical line but at column 50. Drawing Lines and Points 157 Notice that these last two steps position the top tips of the M 40 units apart. The left tip is at column 10 and the right tip is at column 50. The middle point of the letter let s call it the vertex is at column 30. By adding or subtracting 20 columns from this vertex we get symmetry a natural mirror-like quality where one side of the letter is a mirror image of .

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.