Computer Programming
Computer Programming
DEV C++
I. BASIC PARTS
LIBRARY/HEADER TYPES OF DATA
CONSTANTS
▪Fixed values that the program may not alter
once they’re set that are also called literals.
ARITHMETIC OPERATORS
ASSIGNMENT OPERATORS
Function Description
1. pow Exponent
2. sqrt Square root
3. fabs Absolute value
4. abs Absolute value
5. ceil Ceiling
6. floor Floor
7. fmax Maximum
8. fmin Minimum
9. round Round up or down
10. remainder Return to nearest value
CODE
Examples:
TYPECASTING SWITCH STATEMENTS
converting one data type into another one ▪a multiway branch statement.
Syntax: (data type) expression
▪offers a simple method for allocating execution to
(data type) - value that we want to convert, whether various sections of code according on the
a literal value, a variable, or the result of an expression’s value.
expression.
▪provides a straightforward technique for assigning
expression - the “destination” data type that we execution to different code segments in
want to convert the expression to. accordance with the value of the expression.
TYPES OF TYPECASTING
BOOLEAN OPERATORS
enables the program to decide and alter its If a condition is true, the if statement will
behavior in response to that choice. execute a block of statements, but if the
condition is false, the else statement kicks in.
one or more conditions that will be evaluated
or tested by the program. else statements work similarly to if statements,
but their condition is solely dependent on the if
(1) if statement statement’s condition.
consists of a boolean expression followed by
one or more statements.
IF STATEMENT