Sams Teach Yourself C++ in 21 Days

(singke) #1

DAY 3


WEEK 1

3 Working with Variables and Constants

and Constants


Programs need a way to store the data they use or create so it can be used later
in the program’s execution. Variables and constants offer various ways to repre-
sent, store, and manipulate that data.
Today, you will learn


  • How to declare and define variables and constants

  • How to assign values to variables and manipulate those values

  • How to write the value of a variable to the screen


What Is a Variable? ................................................................................................


In C++, a variableis a place to store information. A variable is a location in
your computer’s memory in which you can store a value and from which you
can later retrieve that value.
Free download pdf