vclfm

Lemur zaprasza

Copyright © 1995 by Sams Publishing



Who Should Use This Book



This Book's Philosophy



A Note to the Instructor



Overview





Lesson 1: Programming with Visual C++



Lesson 2: Analyzing Visual C++ Programs



Lesson 3: Data Basics



Lesson 4: Simple Operators



Lesson 5: Upgraded Operators



Lesson 6: Looping Back and Forth



Lesson 7: Break It Up with Functions



Lesson 8: Lots of Data



Lesson 9: Consolidating Items



Lesson 10: Object-Oriented Programming



Lesson 11: Inheritance and Virtual Functions



Lesson 12: Using Disk Files



This Book's CD



Conventions Used in This Book









Visual C++™ in 12 Easy Lessons



Greg Perry and Ian Spencer





201 West 103rd Street, Indianapolis, Indiana 46290



For Mary.











Copyright © 1995 by Sams Publishing



FIRST EDITION



All rights reserved. No part of this book shall be reproduced, stored in a retrieval system, or transmitted by any means, electronic, mechanical, photocopying, recording, or otherwise, without written permission from the publisher. No patent liability
is assumed with respect to the use of the information contained herein. Although every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions. Neither is any liability assumed
for damages resulting from the use of the information contained herein. For information, address Sams Publishing, 201 W. 103rd St., Indianapolis, IN 46290.



International Standard Book Number: 0-672-30637-9



Library of Congress Catalog Card Number: 95-688-46



98 - 97 - 96 - 95 ------ 4 - 3 - 2 - 1



Interpretation of the printing code: the rightmost double-digit number is the year of the book's printing; the rightmost single-digit, the number of the book's printing. For example, a printing code of 95-1 shows that the first printing of the book
occurred in 1995.



Printed in the United States of America



All terms mentioned in this book that are known to be trademarks or service marks have been appropriately capitalized. Sams Publishing cannot attest to the accuracy of this information. Use of a term in this book should not be regarded as affecting the
validity of any trademark or service mark.



Visual C++ is a trademark of Microsoft Corporation.



Publisher and President:



Richard K. Swadley



Acquisitions Manager:



Greg Wiegand



Development Manager:



Dean Miller



Managing Editor:



Cindy Morrow



Marketing Manager:



Gregg Bushyeager



Assistant Marketing Manager:



Michelle Milner









Acknowledgments



I want to thank the editors at Sams Publishing, who somehow take my words and turn them into coherent readable text. Rosemarie Graham and Dean Miller have been behind me for years, and I thank them sincerely. I especially want to thank Grace Buechlein
for her support before and during this book. My hat goes off also to Ian Spencer for his superior expertise that made this book possible.









About the Authors



Greg Perry is quickly becoming one of the most sought-after speakers and writers in the programming field. He is known for being able to take programming topics and bring them down to the beginner's level. Perry has been a programmer and trainer
for the past 18 years. He received his first degree in computer science, and then he received a master's degree in corporate finance. Perry is the author of more than 35 other computer books, including Teach Yourself Object-Oriented Programming with
Visual C++, Moving from C to C++, QBasic Programming 101 (all from Sams Publishing), and The Complete Idiot's Guide to Visual Basic (from Alpha Books). In addition, he has published articles in several publications,
including Software Development, Access Advisor, PC World, and Data Training. In his spare time, he wanders around Italy, eating the world's best ice cream and pasta.



Ian Spencer is a freelance consultant experienced in the diverse worlds of Windows application development and midrange systems development, especially with IBM systems. He has been in the computer industry since graduating in 1981 with a degree
in Computer Science from Manchester University. His main business interests are in providing business solutions in the world of manufacturing companies and providing troubleshooting assistance on development projects. He has written a number of systems
using C++ and class libraries, and he is well-respected as an authority on Windows programming. His other books include Teach Yourself OWL Programming in 21 Days (Sams Publishing). Ian lives in Walsall—somewhere near the middle of
England—with his wife Mary, daughters Philippa and Suzanne, and their dog Ross.









Introduction



The book you hold offers something you might not have encountered before. Whereas other books teach you Visual C++, this book also includes a Visual C++ compiler. With this book, there is literally nothing else to buy (except, of course, the computer)!
Microsoft's Visual C++ compiler turns your computer into a C++ programming powerhouse. The compiler included is the full Visual C++ 1.0 release including all the online help, source code, and libraries. The CD that comes with this book also includes all
the code listings in the book, as well as answers to all the exercises at the end of each unit.



Despite the great CD included, this book would be worthless if it didn't teach C++. Visual C++ in 12 Easy Lessons starts at the beginning, assuming that you don't know Visual C++. By the time you're finished, you will have mastered the Visual C++
language. You'll be learning how to program, how to perform input and output, how to work with disk files, and how to achieve advanced memory management through Visual C++ programs.



If you've looked at the computer want ads lately, you've surely noticed the assortment of C++ programming positions. It seems as if there are always more jobs than C++ programmers. Why not join the ranks? This book will help get you there.











Who Should Use This Book



Visual C++ in 12 Easy Lessons is aimed primarily at beginning programmers who have never programmed or have never seen a C++ program. Text, questions, exercises, and numerous program listings are aimed at both beginning programmers and those new
to Visual C++.



If you already program but have never had the time to tackle Visual C++, this book is right for you because it teaches more than just the language. This book attempts to teach you how to program correctly, concentrating on proper coding techniques in
addition to the Visual C++ language.



This book does not attempt to cover the difficult topic of Windows programming because we believe you need to know the basics of programming first.











This Book's Philosophy



Visual C++ in 12 Easy Lessons extends the traditional programming textbook tutorial by offering all the text and language syntax needed for newcomers to C++. It also offers complete program examples, exercises, questions, tips, warnings,
notes—and, of course, a full-featured Visual C++ compiler.



This book focuses on programming correctly in Visual C++ by teaching structured programming techniques and proper program design. Emphasis is placed on a program's readability rather than on "tricks of the trade" code examples. In this
changing world, programs should be clear, properly structured, and well documented. This book doesn't waver from that philosophy.











A Note to the Instructor



If you're an instructor using this book for your class, you'll find that the inclusion of a Visual C++ compiler lets the entire class participate on the same level, using the same compiler for their programs. When you demonstrate the editing, compiling,
linking, and running of Visual C++ programs, you'll know that your students will be using the same compiler that you use in class.



Each unit offers numerous questions and exercises that provide a foundation for classroom discussions. The answers to all the questions and exercises are on the enclosed CD. In addition, each unit contains one or more Extra Credit programming exercises
that you can assign as homework. The answers to these exercises don't appear on the CD.



The typical semester class is divided into 15 or 16 weeks of study. A useful lesson plan that incorporates this book would spend one week on each lesson, with four exams (one every four weeks). Each lesson contains two units, and one unit can easily be
covered in one classroom sitting.



Because Visual C++ in 12 Easy Lessons becomes a part-time teacher, questioning and guiding the student as he or she reads and learns, you can spend more classroom time looking at complete program examples and exploring the theory of Visual C++
instead of taking time to cover petty details.











Overview



Here is an overview of this book, giving you a bird's-eye view of where you're about to head:











Lesson 1: Programming with Visual C++



This lesson explains what Visual C++ is by giving a brief history of the C++ programming language and presenting an overview of C++'s advantages over other languages. You'll learn how to develop Visual C++ programs and the steps you follow to write and
run programs. You'll dive right into working with the Visual C++ compiler in the second unit. The focus is on using the Visual Workbench to easily compile and run programs.











Lesson 2: Analyzing Visual C++ Programs



This lesson familiarizes you with the format of Visual C++ programs. After you master this lesson, you'll be able to recognize Visual C++ programs and write simple programs that output data.











Lesson 3: Data Basics



Visual C++ supports all kinds of data. This lesson teaches you about Visual C++ variables. You must understand the various data types possible in Visual C++ before you can work with data. You'll see how Visual C++ supports both numeric and character
data.











Lesson 4: Simple Operators



This lesson introduces you to the rich assortment of Visual C++ operators. These operators make up for the fact that the Visual C++ programming language is very small. The operators and their order of precedence are more important in Visual C++ than in
most other programming languages. Before you finish this lesson, you'll be using the relational operators to write programs that make decisions based on calculations and data that the user enters.











Lesson 5: Upgraded Operators



This lesson extends your knowledge of the Visual C++ operators by teaching you some of the more advanced data-manipulation operators and their nuances. Then it goes on to look at the special switch statement used to make complicated decisions more
readable.











Lesson 6: Looping Back and Forth



Visual C++ data processing is powerful due to the looping and selection constructs it offers. This lesson shows you how to write programs that execute certain parts of the program over and over again. After learning about the loop control commands in
the first unit, you'll be ready to control those loops with the commands taught in the second. You'll see how to exit a loop early.











Lesson 7: Break It Up with Functions



As you become more skilled in writing C++, your programs become bigger. This lesson explores the C++ function mechanism and shows how you can break code up into small, simple, understandable units. It explores the concept of scope and the unique C++
feature of allowing more than one function to share the same name.











Lesson 8: Lots of Data



Visual C++ offers arrays that hold multiple occurrences of repeating data but don't require much effort on your part to process. Unlike many other programming languages, Visual C++ also uses pointer variables a great deal. Pointer variables and arrays
work together to give you flexible data storage.











Lesson 9: Consolidating Items



Variables, arrays, and pointers aren't enough to hold the types of data that your programs require. Structures allow for more powerful grouping of many different kinds of data into manageable units and prepare the ground for the C++ class concept of the
next lesson. By the time you reach this lesson, you'll begin to see some limitations of regular variables. By mastering an advanced topic called dynamic memory allocation, you'll be writing advanced memory-management programs that utilize
your system's resources better than most other programming languages allow.











Lesson 10: Object-Oriented Programming



In this lesson, you break away from the traditional programming and learn about the features of C++ that make it the special language it is. After a discussion on the meaning of object orientation, you look at the simple way that structures can become
classes. You then look at features to make classes more usable by controlling their creation and deletion.











Lesson 11: Inheritance and Virtual Functions



Lesson 10 introduced the basic class mechanism. The first unit in this lesson builds on this and shows how to make new classes from old classes. The second unit introduces the real magic of C++ with the clever way C++ can decide which function to call
by examining the objects being used.











Lesson 12: Using Disk Files



Visual C++ is not just a programming language. It is a means of accessing code written by other people, which you can then easily use as your own. In this lesson, you look at how you can use both built-in functions of Visual C++ and more powerful class
libraries of code. Your computer would be too limiting if you couldn't store data to the disk and put that data back into your programs. Disk files are required by most real-world applications. The units in this lesson describe how Visual C++ processes
sequential and random-access files, showing a class library in practice.











This Book's CD



This book contains a full-featured C++ compiler called Visual C++. Visual C++ is made by Microsoft, who need no introduction as the most important software company in the world today. The compiler comes with a Windows-based integrated editor, debugger,
compiler, and linker, which compile both C and C++ programs professionally.











Appendix A explains how to install the Visual C++ compiler on your computer.







The CD is an integral part of learning Visual C++ with Visual C++ in 12 Easy Lessons. It contains all the code from all of this book's programs. The first line of every program in this book contains a comment with the program's CD
filename.



The CD also contains the answers to all review questions and exercises at the end of each lesson, except for the Extra Credit problems.











Conventions Used in This Book



This book uses the following typographic conventions:





Code lines, variables, and any text you see on-screen appear in monospace.





Placeholders in statement syntax explanations appear in italic monospace.





New terms appear in italic.





Filenames in regular text appear in uppercase, such as MYFILE.DAT.





Optional parameters in statement syntax explanations are enclosed in flat brackets ([]). You don't type the brackets when you include these parameters.





Menu commands appear like this: File | Open. This command means to select the Open option from the File menu.







The following items also appear throughout this book:











When further thought is needed on a particular topic, the Note icon brings extra information to your attention.

















A Tip shows you an extra shortcut or advantage possible with the command you just learned.







Sometimes you must take extra care when trying a particular command or function. Warnings point out the dangers before you encounter them yourself.

In addition, you'll find several sidebars with useful information that is related to the topic at hand.













The concept icon and text are located at the beginning of each major section in the book. The concept provides a succinct overview of the material in the section.

















A review section appears at the end of major sections and recaps the material you learned in that section.







Provides a description of a subsequent program listing.





Input Listing

A program listing that teaches the major concepts from the section you just finished.



output

A typical output of the program.



analysis

A detailed description of the program appearing at the end of the previous section in the book.



definition

Definitions of new terms often appear in these definition notes, which are located near the paragraph in which the term first appears.
  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • teen-mushing.xlx.pl
  • Wątki
    Powered by wordpress | Theme: simpletex | © Lemur zaprasza