Coding C++ Flashcards ionicons-v5-c

cout

console output <<

cin

console input >>

Declare

data type

Declare/Initialize Synyax

int i = 1, j = 2; same asint i(1), j(2);

data types

bool, char, int, float, double, void, string

data type chronology

float < double < long double

increment

increase by 1 ++

decrement

decrease by 1 --

pre-increment operator

++var increment variable by one and use new variable value in statement

post-increment operator

var++ increment variable by one but use original variable value in statement

Pre-decrement Operator

--var decrement variable by one and use new variable value in statement

post-decrement operator

var-- decrement variable buy one and use original variable value in statement

identifier

names for naming elements in a program, variable name

assignment operator

the equal sign in an assignment statement

constant

const datatype CONSTANT_NAME = value;

math operators

+, -, *, /, %

modular operator

for integers only

expression

not a statement ;

casting

static_cast <goal datatype> (value);(goal datatype)value;

assignment statement

gives value to a variable

IDE

integrated development environment

string

A sequence of characters , enclosed in quotation marks

programming error types

syntax errors - compile error, exceptions - runtime error, logic error - runtime error

variables

name, type, size, value

naming variable identifiers

begin lowercase, descriptive, camel case

size of function

sizeof(int)

how assignments work

read assignment right to left, value is stored in left box

narrowing

assigning larger type to a smaller type, value may change. use explicit cast

quote escape sequence

"......\" \" ";

constants <climits>

INT_MIN, INT_MAX, FLT, DBL, LONG, SHRT, LDBL, LLONG

exponent function

pow(a, b) same as a^b

specific decimal place Library

<iomanip> ex: cout << setprecision (decimalplace#) << fixed << variable;

check even or odd

# % 2 ==0 even # % 2 == 1 odd

character data type

Stores a single character which can be a letter, number or symbol

conditional operator

An operator that compares two values and produces a boolean that indicates the relationship between the operands.

relational operator

==, !=, >, <, >=, <=

binary operator

&& AND || OR

literal

a constant value int i = 34;

Operands

values operated on by an operator

decision structure

if else statment