tailieunhanh - Absolute C++ (4th Edition) part 14

Absolute C++ (4th Edition) part 14. 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. . | 132 Function Basics 6. Write a function that computes the average and standard deviation of four scores. The standard deviation is defined to be the square root of the average of the four values S - a 2 where a is the average of the four scores s1 s S3 and S4. The function will have six parameters and will call two other functions. Embed the function in a program that allows you to test the function again and again until you tell the program you are finished. 7. In cold weather meteorologists report an index called the wind chill factor which takes into account the wind speed and the temperature. The index provides a measure of the chilling effect of wind at a given air temperature. Wind chill may be approximated by the following formula W t - v .16 t v . 16 where v wind speed in m sec t temperature in degrees Celsius t 10 W wind chill index in degrees Celsius Write a function that returns the wind chill index. Your code should ensure that the restriction on the temperature is not violated. Look up some weather reports in back issues of a newspaper in your library and compare the wind chill index you calculate with the result reported in the newspaper. Parameters and Overloading PARAMETERS 134 Call-by-Value Parameters 134 A First Look at Call-by-Reference Parameters 137 Call-by-Reference Mechanism in Detail 139 Example The swapValues Function 141 Constant Reference Parameters 142 Tip Think of Actions Not Code 143 Mixed Parameter Lists 144 Tip What Kind of Parameter to Use 145 Pitfall Inadvertent Local Variables 146 Tip Choosing Formal Parameter Names 147 Example Buying Pizza 147 OVERLOADING AND DEFAULT ARGUMENTS 151 Introduction to Overloading 151 Pitfall Automatic Type Conversion and Overloading 154 Rules for Resolving Overloading 156 Example Revised Pizza-Buying Program 157 Default Arguments 159 TESTING AND DEBUGGING FUNCTIONS 161 The assert Macro 161 Stubs and Drivers 162 CHAPTER SUMMARY 165 ANSWERS TO SELF-TEST EXERCISES .

TỪ KHÓA LIÊN QUAN
crossorigin="anonymous">
Đã 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.