Skip to Content
Navigating C++ and Object-Oriented Design
book

Navigating C++ and Object-Oriented Design

by Paul Anderson, Gail Anderson
October 1997
Intermediate to advanced
800 pages
20h 48m
English
Pearson
Content preview from Navigating C++ and Object-Oriented Design

3.10. Exercises

1:Write itoh() (Listing 3.3 on page 91) without recursion, and use the same main() program from the chapter. What are the advantages and disadvantages of each version?
2:The recursive version of itoh() (Listing 3.3 on page 91) and Exercise 1 both have void return values because each routine displays the result. Modify the recursive version of itoh() to return a character string pointer to the caller. Use the following program to test your solution.
Listing 3.21. Program with integer-to-hexadecimal conversion
 // itoh2.C - recursive integer-to-hex conversion, returns buffer #include <iostream.h> #include <stdlib.h> int main(int argc, const char *argv[]) { unsigned int num; char *itoh(unsigned int); // returns character pointer if ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Exploring C++20: The Programmer's Introduction to C++

Exploring C++20: The Programmer's Introduction to C++

Ray Lischner

Publisher Resources

ISBN: 0135327482Purchase book