Chapter 12 IM Answers

Chapter 12 IM Answers - An Introduction to Programming with...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
An Introduction to Programming with C++: Fifth Edition 978-1-4188-3618-4 Chapter 12 Answers CONCEPT LESSON REVIEW QUESTIONS 1. a cout << address.length() << endl; 2. d both b and c 3. d none of the above 4. a 0 (zero) 5. c if (part.substr(0, 1) == “A”) 6. c if (part.substr(part.length() – 1, 1) == “B”) 7. b code = part.substr(0, 3); 8. d all of the above 9. b word.insert(2, “a”); 10. c 10 11. a -1 12. c if (static_cast<int>(amount.find(“,”, 0)) >= 0) 13. a result = address.compare(0, 4, “1123”); 14. c 1 15. c result = static_cast<int>(state.find(“CA”, 5)); 16. d 15 17. b code.replace(4, 2, “AB”); 18. a divider.assign(5, ‘*’); 19. b cityState = city + “, ” + state; 20. b letter = word.substr(4, 1); EXERCISES – PENCIL AND PAPER 1. cout << msg.length() << endl; 2. name.erase(0, 2); 3. if (static_cast<int>(rate.find(“%”, rate.length() – 1)) >= 0) rate.replace(rate.length() – 1, 1, “”); //end if 4. code = part.substr(4, 2); 5. amount.erase(1, 1);
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/11/2010 for the course CS 343 taught by Professor Katzman during the Spring '09 term at ITT Tech Tucson.

Page1 / 2

Chapter 12 IM Answers - An Introduction to Programming with...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online