TAILIEUCHUNG - Lecture Programming principles and practice using C++: Chapter 7 - Bjarne Stroustrup

This chapter spends a lot of time of the structure and looks of code; that is, factors that affect comprehension and maintainability. It is a good idea to remind the students that often they are the maintainers (maybe of their own code, a few months after they first wrote it). A useful program is never finished: it will be ported, corrected, extended, etc. | Chapter 7 Completing a Program Bjarne Stroustrup Abstract Tokens and token streams Structs and classes Cleaning up the code Prompts Program organization constants Recovering from errors Commenting Code review Testing A word on complexity and difficulty Variables Stroustrup/Programming/2015 Completing the calculator Now wee need to Complete the implementation Token and Token_stream Get the calculator to work better Add features based on experience Clean up the code After many changes code often become a bit of a mess We want to produce maintainable code Stroustrup/Programming/2015 Token We want a type that can hold a “kind” and a value: struct Token { // define a type called Token char kind; // what kind of token double value; // used for numbers (only): a value }; // semicolon is required Token t; = '8'; // . (dot) is used to access members // (use ‘8’ to mean “number”) = ; Token u = t; // a Token behaves much like a .

Đã 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.