← C++ Programming with CodeWarrior

C++ Programming with CodeWarrior

From the originals

13 scans

Machine-transcribed text and image descriptions. Check the linked original for uncertain words or fine print.

These are transcribed pages from the documents, not the full publications. Open the original for the remaining pages.

Image 1

JAN L. HARRINGTON C++ PROGRAMMING WITH CodeWarrior™ ENCLOSED CD-ROM CONTAINS A FULL FUNCTION, CodeWarrior™ COMPILER FOR RUNNING APPLICATIONS FROM THIS BOOK. Includes CD-ROM (on disc label) • Your fastest way to learn object-oriented programming with C++ from the ground up. • Your fastest way to write 68K and Power Macintosh® code. AP PROFESSIONAL

A book cover with a teal background, large red C and yellow-and-white C++ symbols, a blue starburst badge showing an illustrated worker holding a CD-ROM, and a blue author banner at top right.

Reading notes: The disc label text 'INCLUDES CD-ROM' is partially obscured and read from the illustration. Metroworks logo text was read as 'metrowerks' in the image; spelling is as visible on the cover. The word 'Programming' is partly overlapped by the large red C graphic, so the reading is slightly less certain in that area.

Languages
English
PDF page 1

JAN L. HARRINGTON C++ PROGRAMMING WITH CodeWarrior™ ENCLOSED CD-ROM CONTAINS A FULL FUNCTION, metrowerks CodeWarrior™ COMPILER FOR RUNNING APPLICATIONS FROM THIS BOOK. • Your fastest way to learn object-oriented programming with C++ from the ground up. • Your fastest way to write 68K and Power Macintosh® code. AP PROFESSIONAL

A book cover with a teal background, a large red C and two yellow-and-white C++ symbols, a blue starburst badge showing a man holding a CD labeled as included, and an AP Professional logo in the lower left corner.

Reading notes: The CD label on the illustrated disc is partly obscured and reads only as 'INCLUDES CD-ROM' in part, so its exact wording is uncertain. The reading order of the title block is inferred from visual layout.

Languages
English
PDF page 2

The image is an entirely blank white page with no visible artwork, layout, or printed content.

Reading notes: No visible text or imagery was found in the scan, so the transcript and all printed fields are empty.

PDF page 3

LIMITED WARRANTY AND DISCLAIMER OF LIABILITY

LIMITED WARRANTY AND DISCLAIMER OF LIABILITY ACADEMIC PRESS, INC. ("AP") AND ANYONE ELSE WHO HAS BEEN INVOLVED IN THE CREATION OR PRODUCTION OF THE ACCOMPANYING CODE ("THE PRODUCT") CAN- NOT AND DO NOT WARRANT THE PERFORMANCE OR RESULTS THAT MAY BE OBTAINED BY USING THE PRODUCT. THE PRODUCT IS SOLD "AS IS" WITHOUT WAR- RANTY OF ANY KIND (EXCEPT AS HEREAFTER DESCRIBED), EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTY OF PERFORMANCE OR ANY IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY PARTICU- LAR PURPOSE. AP WARRANTS ONLY THAT THE MAGNETIC CD-ROM(S) ON WHICH THE CODE IS RECORDED IS FREE FROM DEFECTS IN MATERIAL AND FAULTY WORK- MANSHIP UNDER THE NORMAL USE AND SERVICE FOR A PERIOD OF NINETY (90) DAYS FROM THE DATE THE PRODUCT IS DELIVERED. THE PURCHASER'S SOLE AND EXCLUSIVE REMEDY IN THE EVENT OF A DEFECT IS EX PRESSLY LIMITED TO EITHER REPLACEMENT OF THE DISKETTE(S) OR REFUND OF THE PURCHASE PRICE, AT AP' S SOLE DISCRETION. IN NO EVENT, WHETHER AS A RESULT OF BREACH OF CONTRACT, WARRANTY OR TORT (INCLUDING NEGLIGENCE), WILL AP OR ANYONE WHO HAS BEEN INVOLVED IN THE CREATION OR PRODUCTION OF THE PRODUCT BE LIABLE TO PURCHASER FOR ANY DAMAGES, INCLUDING ANY LOST PROFITS, LOST SA VIN GS OR OTHER INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILI- TY TO USE THE PRODUCT OR ANY MODIFICATIONS THEREOF, OR DUE TO THE CON- TENTS OF THE CODE, EVEN IF AP HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY. Any request for replacement of a defective CD-ROM must be postage prepaid and must be accompanied by the original defective CD-ROM, your mailing address and telephone number, and proof of date of purchase and purchase price. Send such requests, stating the nature of the problem, to Academic Press Customer Service, 6277 Sea Harbor Drive, Orlando, FL 32887, 1- 800-321-5068. APP shall have no obligation to refund the purchase price or to replace a CD- ROM based on claims of defects in the nature or operation of the Product. Some states do not allow limitation on how long an implied warranty lasts, nor exclusions or limitations of incidental or consequential damage, so the above limitations and exclusions may not apply to you. This Warranty gives you specific legal rights, and you may also have other rights which vary from jurisdiction to jurisdiction. THE RE-EXPORT OF UNITED STATES ORIGIN SOFTWARE JS SUBJECT TO THE UNITED STATES LAWS UNDER THE EXPORT ADMINISTRATION ACT OF 1969 AS AMENDED. ANY FURTHER SALE OF THE PRODUCT SHALL BE IN COMPLIANCE WITH THE UNITED STATES DEPARTMENT OF COMMERCE ADMINISTRATION REGULATIONS. COMPLI- ANCE WITH SUCH REGULATIONS IS YOUR RESPONSIBILITY AND NOT THE RESPON- SIBILITY OF AP.

Reading notes: Line-break hyphenation in some words (e.g., 'CAN-NOT', 'WAR-RANTY') may affect reading of split terms Mixed spacing in 'SA VIN GS' and 'EX PRESSLY' appears to be extraction artifacts

Printed product names
CD-ROM · Product
Printed dates
1969 · NINETY (90) DAYS
Languages
English
PDF page 4

C++ Programming with CodeWarrior™ Beginning OOP for the Macintosh® and Power Macintosh® Jan L. Harrington AP PROFESSIONAL Boston San Diego New York London Sydney Tokyo Toronto

Printed product names
Macintosh · Power Macintosh
Languages
English
PDF page 5

This book is printed on acid-free paper. E) Copyright© 1995 by Academic Press, Inc. All rights reserved. No part of this publication may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopy, recording, or any information storage and retrieval system, without permission in writing from the publisher. All brand names and product names mentioned in this book are trademarks or registered trademarks of their respective companies. AP PROFESSIONAL 1300 Boylston St., Chestnut Hill, MA 02167 An Imprint of ACADEMIC PRESS, INC. A Division of HARCOURT BRACE & COMPANY United Kingdom Edition published by ACADEMIC PRESS LIMITED 24-28 Oval Road, London NWl 7DX Harrington, Jan L. C++ programming with Code Warrior: beginning OOP for the Macintosh and the Power Macintosh I Jan L. Harrington. p. cm. Includes bibliographical references and index. ISBN 0-12-326420-0 (acid-free paper) 1. Macintosh (Computer) --Programming. 2. C++ (Computer program language) I. Title. QA 76.8.M3H359 1995 005.265--dc20 95-20134 CIP Printed in the United States of America 95 96 97 98 IP 9 8 7 6 5 4 3 2 I

Reading notes: Printed-text spacing and OCR-like splits such as 'Code Warrior' and 'NWl' may reflect extraction artifacts rather than exact print.

Printed product names
Macintosh · Power Macintosh
Printed dates
1995 · 95-20134 · 95 · 96 · 97 · 98
Languages
English
PDF page 6

Contents Preface xv How to Use This Book xvi The Programming Challenges xvi For Readers with Little or No Programming Background xvii For Readers Who Are Fluent in a Language Other than C++ xix What You Need to Know xxi About the CD-ROM :xxii Acknowledgments xxiii Chapter 1: Some Basic Concepts 1 The Anatomy of a Program 1 Language Translation 3 Linking 4 Introducing Binary Numbers 5 Binary and Data Storage 7 v

Reading notes: Source text is a table of contents with page numbers, not advertising copy; no products or prices present

Languages
English
PDF page 7

vi Organizing and Accessing Main Memory 7 Pointers 8 Variables and Data Storage 9 Storing Characters 9 Storing Numbers 11 Binary and Hexadecimal 11 How a Program Executes 13 Chapter 2: Introducing OOP 15 WhyOOP? 16 Classes 17 Classes and Objects 17 Member Functions 17 Communicating with Objects 18 Information Hiding 19 Function Overloading 19 Inheritance 20 Chapter 3: Using CodeWarrior 23 Putting Together a C++ Program 23 The main Function and Function Structure 24 Function Prototypes and Header Files 24 The CodeWarrior Environment 27 Creating Source Code Files 28 Color Text 29 Automatic Balancing 29 Font Preferences 30 Automatic Indenting 31 Editor Window Controls 31 Working with Projects 32 Project Templates . 33 Creating a New Project 35 Opening and Saving the Project File 35 Adding Files 36 Running a Program 37 Setting Project Preferences 38 Working with the SIOUX Window 39 Contents

Reading notes: Page numbers and the text 'vi' appear as bare numerals without clear section linkage

Printed product names
CodeWarrior
Languages
English
PDF page 8

Contents Creating Your First Program 40 Dealing with Syntax Errors 42 Introducing the Debugger 44 Entering the Debugger 44 Stepping Through a Program 45 Viewing Variables 47 Exiting the Debugger 50 Chapter 4: Writing Classes 51 Variables 51 Declaring Integer Variables 53 Adding Comment Statements 53 Declaring Floating Point Variables 54 Declaring Character Variables 55 A First Look at Strings 5 5 Initializing and Assigning Values to Variables 5 6 Initializing Characters 57 Initializing Strings 58 Defining Your Own Variable Types 60 The Scope of Variables and Variable Storage Classes 60 Constants 61 Declaring Member Functions 63 Return Values 63 Formal Parameters 64 Class Declaration Syntax 64 Writing Simple Constructors 66 Writing Other Member Functions 67 Chapter 5: Simple Input and Output 69 Introducing Stream I/ 0 70 Console Output 70 Inserting Constants into a Stream 71 Inserting Variable Contents into a Stream 72 Adding New Lines 72 Console Input 73 String Input 74 vii

Reading notes: The supplied text is a table of contents with page numbers, not advertising copy; no headline is printed.

Languages
English
PDF page 9

viii The Ticket Printer Program 74 Declaring the Class 75 The Member Functions 76 The main Function 76 Creating Objects and Function Binding 77 Calling Member Functions 79 Performing the I/O 79 Programming Challenge Number 1 80 File Operations 80 File Output 82 Opening a File for Output 84 Writing Simple Values to the File 85 File Input 86 Opening a File for Input 86 Reading Simple Values from a File 86 Formatting Stream Output 87 Setting Precision, Width, and Fill 87 Setting Precision 88 Setting Width 89 Setting Fill 89 Setting the ios Flags 89 Programming Challenge Number 2 90 Chapter 6: Arithmetic Operations 93 The Arithmetic Operators 93 Addition, Subtraction, and Multiplication 94 Division 96 Integer versus Floating Point Division 96 Modulo Division 97 The Unary Sign Operators 98 The Increment and Decrement Operators 99 Preincrement and Predecrement 99 Postincrement and Postdecrement 100 Assignment Shorthand 100 Precedence 101 Typecasting 103 Default Typecasting 103 Explicit Typecasting 104 Contents

Reading notes: Source appears to be a table of contents with no advertised products, prices, or dates; headline is not identified as a primary heading.

Languages
English
PDF page 10

Contents Math Library Functions 104 Exponentiation 105 Square Root 105 Absolute Value 106 Floating Point Modulo Division 106 The Calculator Program 107 Programming Challenge Number 3 111 Chapter 7: Making Choices 113 Formulating Logical Expressions 114 Formulating Simple Logical Expressions 114 Character Considerations 11; The Unary Not Operator 116 Formulating Complex Logical Expressions 116 Precedence 118 Handling Not 119 Making Choices: if/else 119 Making Choices: switch 124 Programming Challenge Number 4 126 Making Choices: The ?: Operator 128 Verifying File Operations 129 Chapter 8: Repeating Actions 131 TheNumberFunProgram 131 Repeating Actions: while 133 Initializing the Control Condition 134 Nesting Loops 134 Avoiding Infinite Loops 138 Quick Exits: Break 138 Using a while Loop 139 Repeating Actions: for 141 Programming Challenge Number 5 144 Chapter 9: Arrays 147 Declaring Arrays 148 Referencing Array Values 149 Assigning Values to Arrays 150 ix

Reading notes: Table of contents text shows OCR-like gaps such as 'Character Considerations 11;' and split words like 'TheNumberFunProgram' and 'Using a while Loop'. Page numbers in the contents list are partially uncertain due to character damage.

Languages
English
PDF page 11

x Using One-Dimensional Arrays 151 Passing Data for an Array into a Function 151 Passing Arrays to Functions 154 Arrays of Objects 159 Using Two-Dimensional Arrays 162 Functions and Two-Dimensional Arrays 164 Processing Two-Dimensional Arrays 166 Programming Challenge Number 6 167 Chapter 10: Strings 169 Declaring Strings: A Review 169 Referencing Strings 170 String Manipulation 171 Copying Strings 172 Concatenating Strings 172 Comparing Strings 177 Strings as Function Parameters 179 Declaring String Parameters 180 Passing Strings into Functions 180 Returning Strings from Functions 181 Arrays of Strings 182 Declaring an Array of Strings 184 Manipulating an Array of Strings 185 Strings and Data Files 190 Writing Strings 190 Reading Strings 191 Programming Challenge Number 7 193 Chapter 11: Pointers 195 Pointer Variables 196 How Pointer Variables .. Point" 196 Declaring and Initializing Pointer Variables 196 Accessing Data Pointed to by Pointer Variables 199 Using Pointer Arithmetic 202 Pointer Arithmetic and String Functions 20; Pointers and Parameter Passing 207 Dynamic Binding 211 Contents

Reading notes: Table of contents text contains an uncertain character at 'Point"' and a truncated page number '20;' Some entries show irregular spacing and possible OCR damage

Languages
English