Module 1 Flashcards
Program
Execution of instructions one at a time, sequentially.
CIN
[Characters in]- Reads user input until a whitespace is found
COUT
[Characters out] Outputs
Comments
Single line comments -> //
Multiple lines comments -> /* */
Variables
Named places in memory in which users store values
x = 5: assigns value 5 to variable x
Identifiers
Names which are chosen by the programmer:
- Start with A-Z or _
- Continue with A-Z, 1-9 or _
Expression
A combination of values which evaluate to a value
Literal
A value in the code ( such as 20 or “Quit” )
Operators
Symbols which perform calculations on the data
Compound Operators
Symbols which simultaneously perform calculations and assign the value
Int vs Float
Int: used for items which are countable
Float: used for values coming from measurements
Scientific Notation
- 1.5e9 = 1.5 * 10^9
- 1.5e-9 = 1.5 * 10^-9
Constant Variable
A variable which value is constant ant cant be changed after the assignment.
- const [type]varName;
Math Functions
- pow(x , y): results in x^y
- sqrt(x): results in the square root of x
- fabs(x): results in |x|
Division
- int / int = int
- int / float = float
- n / 0 = Error