# C++ Programming with CodeWarrior — source transcripts, page 1

[Canonical transcript page](https://www.vintageapple.net/transcripts/media/va-c-programming-with-code-warrior-1995-3d541b/1)

## Transcribed source material

Machine transcriptions and image descriptions; uncertain copy may be marked [illegible]. Verify against the linked originals. Historical rights remain with the original owners.

These are transcribed excerpts, not the full publications. Open the originals for remaining pages.

### Image 1

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-c-programming-with-code-warrior-1995-3d541b/1#scan-501f4f335abcb01dc6f1d9c91911e0a3adaa146b5b13dad1eab381782e99946d)

Transcribed text:

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

Image description: 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

[Original Image 1](https://www.vintageapple.net/files/afee427dcbab2fb76b877f6ddc1875610b018be7b4a250df6cb88f5d1c741f51/49daf24c84d99c57a7f681ca.webp)

### PDF page 1

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-c-programming-with-code-warrior-1995-3d541b/1#scan-5d618859fbb6c65ca87ddd8862780064a871d47c685a1736ca16164a36f7f8e6)

Transcribed text:

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

Image description: 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

[Original PDF page 1](https://www.vintageapple.net/files/92a9b94dde98471bf30798a5ce149931ce30ff247f00758227ab1d7d5c2c2310/C_-_Programming_With_Code_Warrior_1995.pdf#page=1)

### PDF page 2

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-c-programming-with-code-warrior-1995-3d541b/1#scan-4098e20d1eaea622817e558ce2c6a0303ac5226bdecada7a8b6a0f6db7cf8a93)

Image description: 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.

[Original PDF page 2](https://www.vintageapple.net/files/92a9b94dde98471bf30798a5ce149931ce30ff247f00758227ab1d7d5c2c2310/C_-_Programming_With_Code_Warrior_1995.pdf#page=2)

### PDF page 3

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-c-programming-with-code-warrior-1995-3d541b/1#scan-7b2dda23915add5d712f4611218d78a5ccdf0ba349d150dd85313d2d80820a0e)

LIMITED WARRANTY AND DISCLAIMER OF LIABILITY

Transcribed text:

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

[Original PDF page 3](https://www.vintageapple.net/files/92a9b94dde98471bf30798a5ce149931ce30ff247f00758227ab1d7d5c2c2310/C_-_Programming_With_Code_Warrior_1995.pdf#page=3)

### PDF page 4

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-c-programming-with-code-warrior-1995-3d541b/1#scan-35a3fdb2fa5c054c62bee6de2fbe80a2a8db17788d6155eebd82f671b0fa66eb)

Transcribed text:

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

[Original PDF page 4](https://www.vintageapple.net/files/92a9b94dde98471bf30798a5ce149931ce30ff247f00758227ab1d7d5c2c2310/C_-_Programming_With_Code_Warrior_1995.pdf#page=4)

### PDF page 5

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-c-programming-with-code-warrior-1995-3d541b/1#scan-1b50155befff4b22cabf97cfffe6c723386309dd54da1ae84a687959043649f1)

Transcribed text:

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

[Original PDF page 5](https://www.vintageapple.net/files/92a9b94dde98471bf30798a5ce149931ce30ff247f00758227ab1d7d5c2c2310/C_-_Programming_With_Code_Warrior_1995.pdf#page=5)

### PDF page 6

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-c-programming-with-code-warrior-1995-3d541b/1#scan-211f977fe19eb17d0cc69c753ce9cf2487f265fa32c7bbc8b87b4b4213a9172c)

Transcribed text:

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

[Original PDF page 6](https://www.vintageapple.net/files/92a9b94dde98471bf30798a5ce149931ce30ff247f00758227ab1d7d5c2c2310/C_-_Programming_With_Code_Warrior_1995.pdf#page=6)

### PDF page 7

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-c-programming-with-code-warrior-1995-3d541b/1#scan-535055f79636322eddda06abf326ef0395093dd43fc0bea95e39068d5281b0f1)

Transcribed text:

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

[Original PDF page 7](https://www.vintageapple.net/files/92a9b94dde98471bf30798a5ce149931ce30ff247f00758227ab1d7d5c2c2310/C_-_Programming_With_Code_Warrior_1995.pdf#page=7)

### PDF page 8

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-c-programming-with-code-warrior-1995-3d541b/1#scan-14c986ab9728e50a53c237090fcf2707b838bdb6aa06bd537563bded9ab46b30)

Transcribed text:

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

[Original PDF page 8](https://www.vintageapple.net/files/92a9b94dde98471bf30798a5ce149931ce30ff247f00758227ab1d7d5c2c2310/C_-_Programming_With_Code_Warrior_1995.pdf#page=8)

### PDF page 9

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-c-programming-with-code-warrior-1995-3d541b/1#scan-784cece2d6197217cc7b9fa33caf2fa4f73d085f7d5c0c8905f65c0a9d4a6bf3)

Transcribed text:

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

[Original PDF page 9](https://www.vintageapple.net/files/92a9b94dde98471bf30798a5ce149931ce30ff247f00758227ab1d7d5c2c2310/C_-_Programming_With_Code_Warrior_1995.pdf#page=9)

### PDF page 10

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-c-programming-with-code-warrior-1995-3d541b/1#scan-3e223f56a134bd1542305b093acd58de532c10742e724396efcf17fdf60170d1)

Transcribed text:

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

[Original PDF page 10](https://www.vintageapple.net/files/92a9b94dde98471bf30798a5ce149931ce30ff247f00758227ab1d7d5c2c2310/C_-_Programming_With_Code_Warrior_1995.pdf#page=10)

### PDF page 11

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-c-programming-with-code-warrior-1995-3d541b/1#scan-0efb6e72fa34f09875a9c7a786d283d58acb4fd8dfb7328e52a958a2cf033251)

Transcribed text:

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

[Original PDF page 11](https://www.vintageapple.net/files/92a9b94dde98471bf30798a5ce149931ce30ff247f00758227ab1d7d5c2c2310/C_-_Programming_With_Code_Warrior_1995.pdf#page=11)

[Next transcribed scans](https://www.vintageapple.net/transcripts/media/va-c-programming-with-code-warrior-1995-3d541b/2.md)
