C++ Programming Fundamentals ( CyberRookies) ISBN:1584502371 by Chuck Easttom Charles River Media © 2003 (417 pages) This text teaches beginners the basics of C++ programming without assuming previous experience in any other language It contains a variety of examples such as game programming, grade tracking and average calculation to make learning C++ fun and valuable CD Content Table of Contents C++ Programming Fundamentals Introduction Section I - C++ Fundamentals Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5 - C++ Basics - Console Input and Output Arrays, Strings, and Bitwise Operations - Functions - Decision Structures and Loops Chapter 6 Chapter 7 Chapter 8 Chapter 9 - File Input and Output - Exception Handling - User-Defined Data Types - Pointers Section II - Object-Oriented Programming Chapter 10 - Classes Chapter 11 - Inheritance Advanced Object-Oriented Chapter 12 Concepts Section III - Advanced Topics in C++ Basic Data Structures and Algorithms Chapter 14 - Build Your Own Game in C++ Chapter 13 - Section IV - Visual C++ Chapter 15 - Introduction to Visual C++ More Windows Applications with Chapter 16 Visual C++ Appendix A - Other Resources Glossary of C++ and Appendix B Programming Terms Appendix C - Answers to Review Questions Appendix D - The C++ Builder Compiler Appendix E - Common Mistakes Appendix F - About the CD-ROM Index List of Figures List of Tables CD Content Back Cover C++ Programming Fundamentals teaches the basics of C++ programming in an easy-to-follow style, without assuming previous experience in any other language A variety of examples such as game programming, club membership, organization, grade tracking and grade point average calculation, make learning C++ both fun and practical Each chapter contains at least one complete, fully functional example program, with several smaller examples provided throughout the book KEY FEATURES Teaches programming basics in C++ without requiring previous experience in another language Discusses all fundamental programming concepts, such as variables and expressions, functions, error and exception handling, classes, inheritance, data structures, and algorithms Contains useful, hands-on projects, including a grade tracking/GPA program, a club membership organizer, a 2D game, a basic unit converter, and more Covers Visual C++ Windows programming with Microsoft Foundation Class (MFC) and class wizards Provides exercises, review questions, and activities at the end of each chapter About the Author Chuck Easttom is the Chair of the computer Information Systems department at Education America He also develops curriculum and teaches computer programming on the college level and has written several programming books C++ Programming Fundamentals Chuck Easttom Charles River Media, Inc Hingham, Massachusetts Copyright 2003 by CHARLES RIVER MEDIA, INC All rights reserved No part of this publication may be reproduced in any way, stored in a retrieval system of any type, or transmitted by any means or media, electronic or mechanical, including, but not limited to, photocopy, recording, or scanning, without prior permission in writing from the publisher Publisher: David Pallai Production: Paw Print Media Cover Design: The Printed Image CHARLES RIVER MEDIA, INC 20 Downer Avenue, Suite 3 Hingham, Massachusetts 02043 781-740-0400 781-740-8816 (FAX) info@charlesriver.com www.charlesriver.com This book is printed on acid-free paper Chuck Easttom C++ Programming Fundamentals ISBN: 1-58450-237-1 All brand names and product names mentioned in this book are trademarks or service marks of their respective companies Any omission or misuse (of any kind) of service marks or trademarks should not be regarded as intent to infringe on the property of others The publisher recognizes and respects all marks used by companies, manufacturers, and developers as a means to distinguish their products Library of Congress Cataloging-in-Publication Data Easttom, Chuck C++ programming fundamentals / Chuck Easttom p cm Summary: Introduces basic concepts of C++ programming, including Microsoft Visual C++, using examples from such areas as game programming and GPA calculation, and provides fully functional sample programs ISBN 1-58450-237-1 (paperback with CD-ROM : alk paper) C++ (Computer program language)—Juvenile literature [1 C++ (Computer program language) 2 Programming (Computers) 3 Computers.] I Title QA76.73.C153 E23 2003 2002151914 Printed in the United States of America 02 7 6 5 4 3 2 First Edition CHARLES RIVER MEDIA titles are available for site license or bulk purchase by institutions, user groups, corporations, etc For additional information, please contact the Special Sales Department at 781-7400400 Requests for replacement of a defective CD-ROM must be accompanied by the original disc, your mailing address, telephone number, date of purchase, and purchase price Please state the nature of the problem, and send the information to CHARLES RIVER MEDIA, INC., 20 Downer Avenue, Suite 3, Hingham, Massachusetts 02043 CRM’s sole obligation to the purchaser is to replace the disc, based on defective materials or faulty workmanship, but not on the operation or functionality of the product LIMITED WARRANTY AND DISCLAIMER OF LIABILITY The CD-ROM which accompanies this book may be used on a single PC only The license does not permit the use on a network (of any kind) You further agree that this license grants permission to use the products contained herein, but does not give you right of ownership to any of the content or product contained on this CD-ROM Use of third party software contained on this CD-ROM is limited to and subject to licensing terms for the respective products Charles River Media, Inc (“CRM”) and/or anyone who has been involved in the writing, creation, or production of the accompanying code (“The software”), or the third party products contained on this CD-ROM, cannot and do not warrant the performance or results that may be obtained by using the software The author and publisher have used their best efforts to ensure the accuracy and functionality of the textual material and programs contained herein; We, however, make no warranty of this kind, express or implied, regarding the performance of these programs The software is sold “as is” without warranty (except for defective materials used in manufacturing the disC or due to faulty workmanship); the sole remedy in the event of a defect is expressly limited to replacement of the disc, and only at the discretion of CRM The author, the publisher, developers of third party software, and anyone involved in the production and manufacturing of this work shall not be liable for damages of any kind arising out of the use of (or the inability to use) the programs, source code, or textual material contained in this publication This includes, but is not limited to, loss of revenue or profit, or other incidental or consequential damages arising out of the use of the product The sole remedy in the event of a claim of any kind is expressly limited to replacement of the book and/or CD-ROM, and only at the discretion of CRM The use of “implied warranty” and certain “exclusions” vary from state to state, and may not apply to the purchaser of this product Acknowledgments No book is really the work of a single person, even if only one name appears on the title First and foremost, I would like to thank a few of my students and one of my colleagues that reviewed rough drafts for me Patrick Langlinais, Nicholas Russo, and Susan Hebert were all gracious enough to look over rough drafts for me and to give me their opinions and their encouragement The publishing team at Charles River Media has also been simply amazing They carefully edited and reviewed the rough drafts, saving me from embarrassing myself! Finally, I must also thank my wife, Misty, and my son, AJ Without their patience and support, none of the books I write would be possible Introduction Overview This book is about C++, a fact you are undoubtedly already aware of There are a lot of other C++ books out there That’s another fact you are probably already aware of Why this one? What is different? First of all, this book is aimed at the beginner, but does not talk down to the reader Yes, you may be a beginner at C++ and perhaps even a beginner at programming But that does not mean you are intellectually challenged, and this book makes no such assumptions Also this book accepts that as a beginner, code snippets are totally inadequate You need complete and total code samples Samples that you can run exactly as they are written For this reason, this book has over 80 completely working code samples, completely written out in the text, and on the CD-ROM There are still a few code snippets scattered throughout the text, but only to illustrate key techniques that are then demonstrated in a complete working program In this book, we will step through the various parts of C++ programming in a very systematic way Many of the concepts you will learn are essential programming concepts, simply applied using the C++ language Along the way the book also strives to teach you ANSI-standard C++ However, occasionally the text does add-in commonly used techniques that are not part of the formal ANSI standard These items will be noted when they appear Finally, the book gives you a peek at Visual C++ programming This is done because Microsoft Windows programming is just so common, it would be a serious omission if the text did not introduce you to this topic Essentially what this book proposes to do is to teach you the fundamentals of computer programming, via the C++ programming language This book endeavors to present C++ in a clear and understandable way without talking down to you The first few chapters use rather standard, simple, example code However, as soon as you have gotten ... Easttom, Chuck C++ programming fundamentals / Chuck Easttom p cm Summary: Introduces basic concepts of C++ programming, including Microsoft Visual C++, using examples from such areas as game programming and GPA calculation, and provides fully functional sample... computer programming on the college level and has written several programming books C++ Programming Fundamentals Chuck Easttom Charles River Media, Inc Hingham, Massachusetts Copyright 2003 by CHARLES RIVER MEDIA, INC... Back Cover C++ Programming Fundamentals teaches the basics of C++ programming in an easy-to-follow style, without assuming previous experience in any other language A variety of examples such as game programming, club