C++ Timesaving Techniques for Dummies phần 10

bởi một hệ thống thành các ký tự có thể. Đối với World Wide Web, ví dụ, nhân vật chẳng hạn như các ký hiệu (&), lớn hơn và các dấu hiệu ít hơn Giao diện với Encoding Internet và giải mã các URL để sử dụng trên Internet Tạo một thử nghiệm URL lớp Codec là lớp học | Converting Numbers to Words Save Time By Understanding the value of converting numbers to words Understanding the basic logic of such a program Creating a conversion class Testing your conversion class If you go into a bank and ask for a cashier s check your bank computer system will print the check for the appropriate amount look closely at that check and you ll see that it has the entire amount spelled out in English. For example if I got a cashier s check for 1 the check would read One thousand two hundred dollars and sixty cents. This is not an unusual use for a software program and the ability to translate numbers to words can be applied in many different types of applications from education to finance. The design of the codesystem that performs this kind of translation is very interesting. The process we go through for this is always done the same way. We break the number no matter how large down into hundreds and then parse the results into English. For example if you are given the number 123 456 you look first at the 123 and append a thousand to it resulting in one hundred twenty-three thousand. Further within a block of hundreds you will always look at numbers from one to twenty then multiples of ten then multiples of a hundred. For example you will list the numbers from one to nineteen for a given hundred then it is twenty twenty-one thirty thirty-one and so forth. A process that breaks something into smaller pieces and then assembles the pieces into larger components should naturally make you think about objects. In this case you can see that there are objects for the one-to-twenty conversion the twenty-and-up conversion and the hundreds conversion. The thousands conversion is really just a variant of the hundreds. All these cases have a common set of things to look at the specific range of the value convert that range into a string Let s look at an example because this is all rather confusing to explain and much easier to show. If we start with .

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
Đã 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.