TAILIEUCHUNG - A Complete Guide to Programming in C++ part 27

A Complete Guide to Programming in C++ part 27. This book provides both novice and experienced programmers with a comprehensive resource manual for the C++ programming language. Readers gain experience in all aspects of programming, from elementary language concepts to professional software development, with in depth coverage of all the language elements en route. These elements are carefully ordered to help the reader create useful programs every step of the way. | SOLUTIONS 239 Function circle Compute circumference and area. void circle const double r double u double f const double pi u 2 pi r f pi r r Exercise 3 ------------------------------------------------------ Definition and call of the function swap . 1. version parameters with pointer type 2. version parameters with reference type. ------------------------------------------------------ include iostream using namespace std void swap float float Prototypes of swap void swap float float int main float x float y cout x and y before swapping x y endl swap x y Call pointer version. cout x and y after 1. swapping x y endl swap x y Call reference version. cout x and y after 2. swapping x y endl return 0 void swap float p1 float p2 Pointer version float temp Temporary variable temp p1 Above call points p1 p1 p2 to x and p2 to y. p2 temp 240 CHAPTER 12 REFERENCES AND POINTERS void swap float a float b Reference version float temp Temporary variable temp a For above call a b a equals x and b equals y b temp Exercise 4 ------------------------------------------------------ Defines and calls the function quadEquation which computes the solutions of quadratic equations a x x b x c 0 The equation and its solutions are printed by the function printQuadEquation . ------------------------------------------------------ include include include include using namespace std iostream iomanip string cmath For the square root sqrt string header Solutions of Quadratic Equations n line 50 - ------ Prototypes-------- Computing solutions bool quadEquation double a double b double c double xlPtr double x2Ptr Printing the equation and its solutions void printQuadEquation double a double b double c int main cout header endl printQuadEquation printQuadEquation printQuadEquation return 0 SOLUTIONS 241 Prints the equation and its solutions void printQuadEquation double a double b double c double xl x2 For .

TỪ KHÓA LIÊN QUAN
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.