Assignment Formatting and Interactive Input
Assignment Formatting and Interactive Input
Assignment Operations Formatting Numbers for Program Output Using Mathematical Library Functions Program Input Using the cin Object Symbolic Constants
Assignment Operations
Assignment statement is the most fundamental C++ statements for both passing on values to variables and performing computations. variable = expression; base = 25; height = 18; a = b = c = 25;
Mr. Orestes Mendoza
Coercion
Coercion is referred to conversion of data type from one type to another. int a; float b;
a = 5.46; // value is converter to integer (5) b = 43; // value is converted to float (43.0)
Assignment Variations
Accumulating
variable = variable + otherVariable
Counting
variable = variable + fixedNumber
Symbolic Constant
A symbolic constant is name that substitute a sequence of character that cannot be changed.
numeric constant character constant string.
Placement of Statements
The general rule in C++ for variable or symbolic constant must be declared before it can be used.
preprocessor directives int main() { symbolic constants variable declarations other executable statements return value }