Course Web Pages

Related Links

Free eBooks


Variables

The videos below demonstrate the use of variables in a C++ program with examples from  Dawson's Beginning C++ book. 

Variables

Arithmetic operations.

const and enum

The #define preprocessor directive.

String input

Naming Conventions

Different organizations have their own conventions for variable names. See, for example, the Variable Names entry in Google's Style Guide for C++. The important thing is to use meaningful names, be consistent, and pay attention to conventions used by the wider programming community.

Exercise

Write a program that accepts a user name and three numbers, then prints out the user name and the average of the three numbers.