CyberSlug Rules!

Beginner Programming CMPS060

Prof. Paulo Franca

Home

Syllabus

Login

Objects

Download

Staff only

Labeled constants

for convenience, you can assign an identifier to a constant value;
  • a variable that cannot change value!
  • use just like a variable in the program;
  • if you try to change the value, cause error message.

precede the declaration with the keyword const

const int black=7,green=4;
const float pi=3.14159,e=2.71828;