Absolute C++ (4th Edition) part 29

Absolute C++ (4th Edition) part 29. KEY BENEFIT: C++ programming concepts and techniques are presented in a straightforward style using understandable language and code. KEY TOPICS: C++ Basics; Flow of Control; Function Basics; Parameters and Overloading; Arrays; Structures and Classes; Constructors; Operator Overloading, Friends, and References; Strings; Pointers and Dynamic Arrays; Separate Compilation and Namespaces; Streams and File I/O; Recursion; Inheritance; Polymorphism and Virtual Functions; Templates; Linked Data Structures; Exception Handling; Standard Template Library; Patterns and UML. MARKET: Useful for both beginning and intermediate C++ programmers. . | More Tools 283 Display The const Parameter Modifier part 2 of 3 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 int dollarsPart double amount const int centsPart double amount const int round double number const double fraction double percent const Converts a percentage to a fraction. For example fraction returns . Returns true if the balance in accountl is greater than that in account . Otherwise returns false. bool isLarger const BankAccount accountl const BankAccount account void welcome const BankAccount yourAccount int main BankAccount account1 6543. 1 account welcome accountl cout Enter data for account n account .input if isLarger account1 account cout accountl is larger. n else cout account is at least as large as account1. n return 0 bool isLarger const BankAccount accountl const BankAccount account return account .getBalance void welcome const BankAccount yourAccount cout Welcome to our bank. n The status of your account is n Uses iostream and cstdlib void BankAccount output const The rest of the function definition is the same as in Display . Other function definitions are the same as in Display except that const is added where needed to match the function declaration. 284 Constructors and Other Tools Display The const Parameter Modifier part 3 of 3 Sample Dialogue Welcome to our bank. The status of your account is Account balance Rate Enter data for account 2 Enter account balance Enter interest rate NO percent sign 10 account1 is larger. INLINE FUNCTIONS You can give the complete definition of a member function within the definition of its inline function class. Such definitions are called inline function definitions. These inline definitions are typically used for very short function definitions. Display shows the class in Display rewritten with a number of inline functions. Inline functions .

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.