Data Variables and Constants

I l @ ve RuBoard

Data Variables and Constants

A computer, under the guidance of a program, can do many things. It can add numbers, sort names , command the obedience of a speaker or video screen, calculate cometary orbits, prepare a mailing list, dial phone numbers , draw stick figures, draw conclusions, or anything else your imagination can create. To do these tasks , the program needs to work with data , the numbers and characters that bear the information you use. Some data are preset before a program is used and keep their values unchanged throughout the life of the program. These are constants . Other data may change or be assigned values as the program runs; these are variables . In the sample program, weight is a variable and 14.5833 is a constant. What about the 320.0 ? True, the price of gold isn't a constant in real life, but this program treats it as a constant. The difference between a variable and a constant is that a variable can have its value assigned or changed while the program is running, and a constant can't.

I l @ ve RuBoard


C++ Primer Plus
C Primer Plus (5th Edition)
ISBN: 0672326965
EAN: 2147483647
Year: 2000
Pages: 314
Authors: Stephen Prata

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net