HOW TO PROGRAM EIGHTH EDITION GLOBAL EDITION with an introduction to C++ This page intentionally left blank HOW TO PROGRAM EIGHTH EDITION GLOBAL EDITION with an introduction to C++ Paul Deitel Deitel & Associates, Inc. Harvey Deitel Deitel & Associates, Inc. Global Edition contributions by Piyali Sengupta Boston Columbus Hoboken Indianapolis New York San Francisco Amsterdam Cape Town Dubai London Madrid Milan Munich Paris Montreal ˜ Paulo Sydney Hong Kong Seoul Singapore Taipei Tokyo Toronto Delhi Mexico City Sao Vice President and Editorial Director, ECS: Marcia J. Horton Executive Editor: Tracy Johnson (Dunkelberger) Editorial Assistant: Kelsey Loanes Assistant Acquisitions Editor, Global Editions: Aditee Agarwal Program Manager: Carole Snyder Project Manager: Robert Engelhardt Project Editor, Global Editions: K.
Neelakantan Media Team Lead: Steve Wright R&P Manager: Rachel Youdelman R&P Senior Project Manager: William Opaluch Senior Operations Specialist: Maura Zaldivar-Garcia Senior Manufacturing Controller, Global Editions: Kay Holman Inventory Manager: Bruce Boundy Marketing Manager: Demetrius Hall Product Marketing Manager: Bram Van Kempen Media Production Manager, Global Editions: Vikram Kumar Marketing Assistant: Jon Bryant Cover Designer: Chuti Prasertsith / Michael Rutkowski / Marta Samsel Cover Art: © Igoror / Shutterstock Pearson Education Limited Edinburgh Gate Harlow Essex CM20 2JE England and Associated Companies throughout the world Visit us on the World Wide Web at: www.com © Pearson Education Limited 2016 The rights of Paul Deitel and Harvey Deitel to be identified as the authors of this work have been asserted by them in accordance with the Copyright, Designs and Patents Act 1988. Authorized adaptation from the United States edition, entitled C How to Program: with an introduction to C++,8st edition, ISBN 978-0-13-397689-2, by Paul Deitel and Harvey Deitel published by Pearson Education © 2016. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, electronic, mechanical, photocopying, recording or otherwise, without either the prior written permission of the publisher or a license permitting restricted copying in the United Kingdom issued by the Copyright Licensing Agency Ltd, Saffron House, 6–10 Kirby Street, London EC1N 8TS.
All trademarks used herein are the property of their respective owners. The use of any trademark in this text does not vest in the author or publisher any trademark ownership rights in such trademarks, nor does the use of such trademarks imply any affiliation with or endorsement of this book by such owners. British Library Cataloguing-in-Publication Data A catalogue record for this book is available from the British Library 10 9 8 7 6 5 4 3 2 1 ISBN 10: 1-292-11097-X ISBN 13: 978-1-292-11097-4 Typeset by GEX Publishing Services Printed in Malaysia In memory of Dennis Ritchie, creator of the C programming language and co-creator of the UNIX operating system. Paul and Harvey Deitel Trademarks DEITEL, the double-thumbs-up bug and DIVE INTO are registered trademarks of Deitel and Associates, Inc.
Apple, Xcode, Swift, Objective-C, iOS and OS X are trademarks or registered trademarks of Apple, Inc. Java is a registered trademark of Oracle and/or its affiliates. Microsoft and/or its respective suppliers make no representations about the suitability of the information contained in the documents and related graphics published as part of the services for any purpose. All such documents and related graphics are provided “as is” without warranty of any kind.
Microsoft and/ or its respective suppliers hereby disclaim all warranties and conditions with regard to this information, including all warranties and conditions of merchantability, whether express, implied or statutory, fitness for a particular purpose, title and non-infringement. In no event shall Microsoft and/or its respective sup- pliers be liable for any special, indirect or consequential damages or any damages whatsoever resulting from loss of use, data or profits, whether in an action of contract, negligence or other tortious action, arising out of or in connection with the use or performance of information available from the services. The documents and related graphics contained herein could include technical inaccuracies or typograph- ical errors. Changes are periodically added to the information herein.
Microsoft and/or its respective sup- pliers may make improvements and/or changes in the product(s) and/or the program(s) described herein at any time.