Example: air traffic controller

C: How to Program: with an introduction to C++ Global ...

Global EDITIONEIGHTH EDITION with an introduction to C++HOW TO PROGRAMThis page intentionally left blankGLOBAL EDITIONPaul DeitelDeitel & Associates, DeitelDeitel & Associates, EDITION with an introduction to C++ Global Edition contributions byPiyali SenguptaBoston Columbus Hoboken Indianapolis New York San Francisco Amsterdam Cape Town Dubai London Madrid Milan Munich Paris MontrealToronto Delhi Mexico City Sao Paulo Sydney Hong Kong Seoul Singapore Taipei Tokyo HOW TO PROGRAMVice President and Editorial Director, ECS: Marcia J. HortonExecutive Editor: Tracy Johnson (Dunkelberger)Editorial Assistant: Kelsey LoanesAssistant Acquisitions Editor, Global Editions: Aditee AgarwalProgram Manager: Carole SnyderProject Manager: Robert Engelhardt Project Editor, Global Editions: NeelakantanMedia Team Lead: Steve WrightR&P Manager: Rachel YoudelmanR&P Senior Project Manager: William OpaluchSenior Operations Specialist: Maura Zaldivar-Garcia Senior Manufacturing Controller, Global Editions: Kay HolmanInventory Manager: Bruce BoundyMarketing Manager: Demetrius HallProduct Marketing Manager: Bram Van KempenMedia Production Manager, Global Editions: Vikram KumarMarketing Assistant: Jon BryantCover Designer: Chuti Prasertsith / Michael Rutkowski / Marta Samsel Cover Art: Igoror / Shutterstock Pearson Education LimitedEdinburgh GateHarlowEssex CM20 2 JEEnglandand Associated Companies throughout the worldVisit us on the World Wide Web Pearson Education Lim

3.1 Introduction 102 3.2 Algorithms 102 3.3 Pseudocode 102 3.4 Control Structures 103 3.5 The if Selection Statement 105 3.6 The if…else Selection Statement 106 3.7 The while Iteration Statement 110 3.8 Formulating Algorithms Case Study 1: Counter-Controlled Iteration 111 3.9 Formulating Algorithms with Top-Down, Stepwise Refinement

Tags:

  Programs, How to program

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Advertisement

Transcription of C: How to Program: with an introduction to C++ Global ...

1 Global EDITIONEIGHTH EDITION with an introduction to C++HOW TO PROGRAMThis page intentionally left blankGLOBAL EDITIONPaul DeitelDeitel & Associates, DeitelDeitel & Associates, EDITION with an introduction to C++ Global Edition contributions byPiyali SenguptaBoston Columbus Hoboken Indianapolis New York San Francisco Amsterdam Cape Town Dubai London Madrid Milan Munich Paris MontrealToronto Delhi Mexico City Sao Paulo Sydney Hong Kong Seoul Singapore Taipei Tokyo HOW TO PROGRAMVice President and Editorial Director, ECS: Marcia J. HortonExecutive Editor: Tracy Johnson (Dunkelberger)Editorial Assistant: Kelsey LoanesAssistant Acquisitions Editor, Global Editions: Aditee AgarwalProgram Manager: Carole SnyderProject Manager: Robert Engelhardt Project Editor, Global Editions: NeelakantanMedia Team Lead: Steve WrightR&P Manager: Rachel YoudelmanR&P Senior Project Manager: William OpaluchSenior Operations Specialist: Maura Zaldivar-Garcia Senior Manufacturing Controller, Global Editions: Kay HolmanInventory Manager: Bruce BoundyMarketing Manager: Demetrius HallProduct Marketing Manager: Bram Van KempenMedia Production Manager, Global Editions: Vikram KumarMarketing Assistant: Jon BryantCover Designer: Chuti Prasertsith / Michael Rutkowski / Marta Samsel Cover Art.

2 Igoror / Shutterstock Pearson Education LimitedEdinburgh GateHarlowEssex CM20 2 JEEnglandand Associated Companies throughout the worldVisit us on the World Wide Web 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 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 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 trademarks used herein are the property of their respective owners.

3 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 Library Cataloguing-in-Publication DataA catalogue record for this book is available from the British Library10 9 8 7 6 5 4 3 2 1 ISBN 10: 1-292-11097-XISBN 13: 978-1-292-11097-4 Typeset by GEX Publishing ServicesPrinted in MalaysiaIn memory of Dennis Ritchie,creator of the C programming languageand co-creator of the UNIX operating and Harvey DeitelTrademarks DEITEL, the double-thumbs-up bug and DIVE INTO are registered trademarks of Deitel and Associates, , Xcode, Swift, Objective-C, iOS and OS X are trademarks or registered trademarks of Apple, 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.

4 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 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.

5 Partial screen shots may be viewed in full within the software version names may be trademarks of their respective F, G and H are PDF documents posted online at the book s CompanionWebsite (located at ).Preface 231 introduction to Computers, the Internet and the Web and Software s Law Organization Hierarchy Languages, Assembly Languages and High-Level Languages C Programming Language Standard Library ++ and Other C-Based Languages Technology Automobile as an Object and Classes and Method Calls and Instance Variables and Information Hiding C Program-Development Environment 1: Creating a Program 2 and 3: Preprocessing and Compiling a C Program 4: Linking 5: Loading 6.

6 Execution That May Occur at Execution Time Input, Standard Output and Standard Error Streams a C Application in Windows, Linux and Mac OS X Running a C Application from the Windows Command Prompt Running a C Application Using GNU C with Linux Running a C Application Using the Teminal on Mac OS X Systems Windows A Proprietary Operating System Linux An Open-Source Operating System Apple s Mac OS X; Apple s iOS for iPhone , iPad and iPod Touch Devices Google s Android Internet and World Wide Web The Internet: A Network of Networks The World Wide Web: Making the Internet User-Friendly Web Services Ajax The Internet of Things Key Software Terminology Up-to-Date with Information Technologies 662 introduction to C Programming Simple C Program: Printing a Line of Text Simple C Program: Adding Two Integers Concepts in C Making.

7 Equality and Relational Operators C Programming 893 Structured Program Development in C Structures if Selection Statement Selection Statement while Iteration Statement Algorithms Case Study 1: Counter-Controlled Iteration Algorithms with Top-Down, Stepwise Refinement Case Study 2: Sentinel-Controlled Iteration Algorithms with Top-Down, Stepwise Refinement Case Study 3: Nested Control Statements Operators and Decrement Operators C Programming 1274C Program Control Essentials Iteration Iteration Statement Statement.

8 Notes and Observations Using the for Statement Multiple-Selection Statement Iteration Statement and continue Statements Operators Equality (==) and Assignment (=) Operators Programming Summary C Programming 1745C Functions programs in C Library Functions Definitions Function Function Prototypes: A Deeper Look Call Stack and Stack Frames Arguments By Value and By Reference Number Generation : A Game of Chance; Introducing enum Classes Rules Using Recursion: Fibonacci Series vs.

9 Iteration C Programming 2276C Arrays Arrays Examples an Array and Using a Loop to Set the Array s Element Values an Array in a Definition with an Initializer List an Array s Size with a Symbolic Constant and Initializing Array Elements with Calculations the Elements of an Array Arrays to Summarize Survey Results Array Element Values with Histograms a Die 60,000,000 Times and Summarizing the Results in an Array Character Arrays to Store and Manipulate Strings a Character Array with a String a Character Array with an Intializer List of Characters the Characters in a String into a Character Array a Character Array That Represents a String Character Arrays Local Arrays and Automatic Local Arrays Arrays to Functions Arrays Study.

10 Computing Mean, Median and Mode Using Arrays Arrays Searching an Array with Linear Search Searching an Array with Binary Search Arrays Illustrating a Double-Subcripted Array Initializing a Double-Subcripted Array Setting the Elements in One Row Totaling the Elements in a Two-Dimensional Array Two-Dimensonal Array Manipulations Arrays C Programming 2887C Pointers Variable Definitions and Initialization Operators Arguments to Functions by Reference the const Qualifier with Pointers a String to Uppercase Using a Non-Constant Pointer to Non-Constant Data a String One Character at a Time Using a Non-Constant Pointer to Constant Data to Modify a Constant Pointer to Non-Constant Data to Modify a Constant Pointer to Constant Data Sort