Professional Documents
Culture Documents
A Beginners C++
This page contains information concerning a draft version of a book "A Beginners' C++"; this book is intended for "CS1, CS2" introductory Computer Science courses that use C++ as an implementation language. Note: this text was completed in 1996. C++ has been revised quite a bit since then! When the examples were written, C++'s "namespace" feature had been defined but was not supported on available compilers; so the examples don't use namespace. (Of course, in modern C++ they should.) Further, the iostream library has been updated. Some of the functions have changed their signatures; some features have been added, others removed. So, be cautious with the code - it is well a little out of date.
A Beginners C++
The table of contents given below includes links to additional materials. Some complete chapters, and various subsections, are available either as Postscript files or directly readable "html" text. There are also links to a couple of files with example code. The code should be usable with the Borland development environment for the PC, or Symantec-8 for the Macintosh. To save space and transmission time, many of the Postscript files have been compressed. The files were compressed using gzip on Unix. You have to uncompress them (gunzip) before viewing them with ghostview or sending to a printer. (If you go to Javaworld you will usually find that they have dowloadable copies of gzip utilities for both Mac and PC available on their page. The links are at the bottom after their stories about Java developments.) (If you need a viewer for postscript, try: University Wisconsin, ghostscript, ghostview, gs page ) The postscript files have been "distilled" into Adobe PDF files. This makes them smaller, and so easier to download; it should also make them easier to read on a variety of systems.
Preface
(PDF of table of contents)
www.uow.edu.au/~/nabg/ABC/ABC.html 1/9
11/10/13
A Beginners C++
11/10/13
A Beginners C++
9. The "Algol Family":AlgolW, Pascal, and Modula2* ADA* BCPL, C, and C++* Simula, SmallTalk, and Eiffel* (PDF of chapter) 5. C++ development environment (Postscript file of chapter) 1. Integrated Development Environment 2. C++ input and output 3. A simple example program in C++:Design* Implementation* (PDF of chapter)
11/10/13
A Beginners C++
4. Terminating a program 5. Example Programs: Calculating some simple statistics* Newton's method for roots of polynomials* 6. What is the Largest? What is the Smallest? 9. Simple use of files 1. Dealing with more data 2. Defining filestream objects 3. Using input and output filestreams 4. Stream states 5. Options when opening filestreams 6. When to stop reading data? 7. More Formatting options 8. Example (html text of most of section on files) (PDF of chapter)
11/10/13
A Beginners C++
12.
13.
14.
15.
16.
17.
6. Multi-dimensional arrays: Definition and initialization* Accessing individual elements* As arguments to functions* 7. Arrays of Fixed length Strings 8. Examples using arrays: Letter Counts* Simple encryption* Simple image processing* (PDF of chapter) Programs with functions and arrays (postscript file of chapter with several examples using functions and arrays) 1. Curses 2. Heat diffusion 3. Menu Selection 4. Pick the keyword 5. Hangman (html text of section introducing hangman problem), (text file with all hangman code) 6. Life (PDF of chapter) Standard algorithms(Postscript text of chapter on standard searching and sorting functions) 1. Finding the Right Element: Binary Search: An iterative binary search routine* Isn't it a recursive problem?* What was the cost? 2. Establishing Order 3. A simple sort of sort 4. Quicksort: a better sort of sort: The algorithm* An implementation* An enhanced implementation* (html text of section on Quicksort) (PDF of chapter) 5. Algorithms, Functions, and Subroutine Libraries Tools (html text chapter on support tools for program development), 1. The "Code Coverage" Tool 2. The Profiler (PDF of chapter) Design and documentation : 1 1. Top down functional decomposition 2. Documenting a design (PDF of chapter) (PDF of coding guidelines) Enum, Struct, and Union 1. Enumerated types 2. structs 3. Unions(html text of section on C/C++ Unions) (PDF of chapter) Examples using structs 1. Reordering the class list again
5/9
www.uow.edu.au/~/nabg/ABC/ABC.html
11/10/13
A Beginners C++
2. Points and Rectangles 3. File of Records (PDF for chapter) 18. Bits and pieces(Postscript file for chapter explaining role of bit-level operations in C/C++) 1. Bit manipulations 2. Making a Hash of it: Example hashing function for a character string* A simple "hash table"* Example: identifying the commonly used words* 3. Coding "Property Vectors" 4. Pieces (Bit fields) (PDF of chapter)
11/10/13
A Beginners C++
22.
23.
24.
25.
26.
6. Collection class Libraries (PDF of chapter) A World of Interacting Objects 1. RefCards: Design* Implementation* 2. InfoStore: Initial design outline for InfoStore* Design and Implementation of the Vocabulary class* Other classes in the InfoStore program* Final class design for the InfoStore program (Postscript file, long case studies suggesting how to identify and then characterize objects and their classes (PDF of chapter) Intermediate class 1. Shared Class Properties 2. Friends 3. Iterators: ListIterator* TreeIterator*(html file on Iterators for collection classes), (example code with tree iterator) 4. Operator functions: Defining operator functions* Operator functions and the iostream library* 5. Resource Manager Classes and Destructors: Resource management* Destructor functions* The assignment operator and copy constructors* 6. Inheritance: Discovering similarities among prototype classes* Defining Class Hierarchies in C++* But how does it work?!* Multiple Inheritance* Using Inheritance (html file of section introducing inheritance and C++ class hierarchies) (PDF of chapter) Two more "trees"(Postscript file of chapter on AVL trees and Btree storage structures) 1. AVL Trees: What's wrong with binary trees?* Keeping your balance* An implementation* Testing!*(code for an AVL tree class) 2. BTree: Multiway trees* A tree on a disk?* BTree: search, insertion, and deletion operations* An implementation* Testing* (code in C30 example) (PDF of chapter) Templates (Postscript file of Templates chapter) 1. A general function and its specializations 2. Language Extensions for Templates:Template declaration* Template instantiation* 3. Specialized Instantiations of Template Code 4. A Template Version of QuickSort 5. The Template Class "Bounded Array" 6. The Template Class Queue (PDF of chapter) Exceptions (Postscript file of Exceptions chapter) 1. C++'s Exception Mechanism 2. Example: Exceptions for class Number
7/9
www.uow.edu.au/~/nabg/ABC/ABC.html
11/10/13
A Beginners C++
3. Identifying the Exceptions that you intend to throw (PDF of chapter) 27. Example: Supermarket 1. Background and Program Specification/li> 2. Design: Design preliminaries* Scenarios: identifying objects, their classes, their responsibilities, their data* Filling out the definitions of the classes for a partial implementation* 3. A partial implementation 4. Finalising the Design: Histograms* Simulating the checkouts and their queues* Organizing the checkouts* (PDF of chapter) 28. Design and documentation: 2 1. Object-Based Design 2. Documenting a design (PDF of chapter)
11/10/13
A Beginners C++
1. "Resources" and "Macros" 2. Architects, Experts, and Wizards 3. Graphics 4. Persistent Data 5. The Event Handlers 6. The Same Patterns in the code (PDF of chapter) (page index) (Another document on use of frameworks.) (Postscript introduction to frameworks like ET++ and MacApp)
Java? Some teaching materials from an introductory course on Java and the Internet for those who have a little background in C++. CSCI213: Java and the Internet Please email questions to nabg@cs.uow.edu.au
www.uow.edu.au/~/nabg/ABC/ABC.html
9/9