Skip over navigation

Contents

Getting Started in C++

Introduction and Summary

Table of Contents

Terms

C++ is a computer programming language that supports object-oriented programming, meaning it is largely concerned with the manipulation of special variables called objects. Classes are used to create objects, but before learning about them it is essential to understand the basic structure of C++ programs and the elements that form the basis of class definitions. The general format of a C++ program starts with one or more header files, which contain predefined functions and classes. Using the #include keyword, you can use such files, allowing your program to access the classes and functions they define. After the header files come class definitions and definitions of their respective member functions, followed by other functions for your program. After declaring global variables for your program, the main() function is defined. This is where program execution begins.

Programming is essentially the manipulation of variables, of which there are several varieties. Integers, characters, and floating point numbers form the crux of C++'s primitive data types. Each type has a different range of values it can assume. Most character values can be written as keyboard characters between single quotation marks; however, some symbols require special escape sequences to represent the character, such as the tab character '\\t'. Variables should be declared const if they hold a value that will not change for the duration of the program. You can create your own kind of data type with the enum command, which allows you to specify the name of your data type and the values it can take on.

Follow Us