Jump to content

Saylor.org's C++ Programming

0% developed
From Wikibooks, open books for an open world

Dear Wikipedians,

No doubt some of you are familiar with the free college courses available on Saylor.org. Much like the Wikimedia community, we are committed to providing free and accessible education for everyone with internet access. At Saylor, we combine some of our custom-created educational materials with materials that are already available throughout the internet. However, because we sometimes use links to third party materials, those sections of our courses are not entirely sustainable. The Saylor Wikibooks Project is a way for you to help minimize that threat. We’ve uploaded a number of our course outlines to Wikibooks in the hope that you all will contribute to our effort. Our course outlines have been developed by our consultant professors by studying a collection of syllabi of relevant courses from various traditional brick and mortar institutions. This guarantees that our students will be provided the same learning opportunity as a student enrolled in a traditional institution. We believe that we have created the best structure for our courses, which optimizes the information that students would be expected to know. By creating openly licensed content that fits in with Saylor’s established course outlines, (in the form of Wikibooks’ textbooks), you can add to the ever-expanding body of wiki material, while simultaneously improving the sustainability of our courses.

Thanks for your help,

The Saylor Team


If you'd like to learn more about the project please visit User:Thomas_Simpson



Summary

We will begin with a discussion of the essential elements of C++ programming: variables, loops, expressions, functions, and string class. Next, we will cover the basics of object-oriented programming: classes, inheritance, templates, exceptions, and file manipulation. We will then review function and class templates and the classes that perform output and input of characters to/from files. This text will also cover the topics of namespaces, exception handling, and preprocessor directives. In the last part of the text, we will learn some slightly more sophisticated programming techniques that deal with data structures such as linked lists and binary trees.


Global Learning Outcomes

Upon successful completion of this course, students will be able to:

  • Compile and execute code written in C++ language.
  • Work with the elementary data types and conditional and iteration structures.
  • Define and use functions, pointers, arrays, struct, unions, and enumerations.
  • Write C++ using principles of object-oriented programming.
  • Write templates and manipulate the files.
  • Code and use namespaces, exceptions, and preprocessor instructions.
  • Write a code that represents linked lists and binary trees.
  • Translate simple word problems into C++ language.


Upon successful completion of this unit, students will be able to:

  • Describe the basic history of C++.
  • Set up a NetBeans IDE for a simple C++ project.
  • Create and compile a simple C++ program.
  • Use cout and cin objects effectively.
  • Declare and use variables.
  • Use conditional and iteration structures in C++.
  • Define and use simple functions.


1.1 History of C++: Origins and Examples
1.2 How to Compile and Run a C++ Program
1.2.1 Linux Way
1.2.2 Other Ways with NetBeans
1.3 Basics of C++
1.3.1 Structure of a Program
1.3.2 Variables, Data Types, and Constants
1.3.3 Basic Input and Output
1.3.4 Control Structures
1.3.5 Simple Functions
1.4 C++ Reference
1.5 C++ Coding Practice

Upon successful completion of this unit, students will be able to:

  • List the operators in C++ language.
  • Define and use arrays, struct, unions, and enumerations.
  • Use pointers.
  • Use the functions of string class.


2.1 Arithmetic Operators
2.2 Basic Data Structures
2.2.1 Arrays and Strings
2.2.2 Pointers
2.2.3 Struct, Unions, and Enumerations
2.3 C++ Coding Practice: String Class

Upon successful completion of this unit, students will be able to:

  • Define and compare/contrast constructors and deconstructors.
  • Design pointers to the class and create overloading operators.
  • Define and use the keyword “this” and use the static members appropriately.
  • Design and appropriately use friend functions and classes.
  • Use the class inheritance for better code design.
  • Explain how polymorphism is achieved through C++ code.


3.1 Class Design
3.1.1 Constructors and Destructors
3.1.2 Overloading Constructors and Pointers to Classes
3.1.3 Overloading Operators
3.1.4 The Keyword “This”
3.1.5 Static Members
3.2 Inheritance Between Classes
3.2.1 Friend Functions
3.2.2 Friend Classes
3.2.3 Inheritance Between Classes
3.2.4 Multiple Inheritance
3.3 Polymorphism
3.3.1 Pointers to Base Class
3.3.2 Virtual Members
3.3.3 Abstract Base Classes
3.4 Coding Drills

Upon successful completion of this unit, students will be able to:

  • Write class and function templates.
  • Code with a class that manipulates the files.
  • Use namespaces and exceptions in C++ code.
  • Write preprocessor instructions.


4.1 Templates
4.1.1 Function Templates
4.1.2 Class Templates
4.1.3 Template Specialization
4.1.4 Non-type Parameters for Templates
4.1.5 Templates and Multiple-file Projects
4.2 Input/Output With Files
4.2.1 Open and Close a File
4.2.2 Text Files
4.2.3 Binary Files
4.3 Namespaces
4.4 Exceptions
4.5 Preprocessor Directives

Upon successful completion of this unit, students will be able to:

  • Describe and code the binary tree structure.
  • Code special data structures by combining linked lists and binary trees.


5.1 Coding Drills: Binary Trees
5.2 Coding Drills: List of Binary Trees