The flashcards below were created by user
Anonymous
on FreezingBlue Flashcards.
-
argument
arguments are data being sent to the function.
i.e. pow(2.0,3.0)
the 2.0 and the 3.0 are the argument
-
cin
cin object can be used to read data typed at the keyboard and store it in to a variable.
i.e.
- cout << "What is your name?";
- cin >> name;
-
basic requirements of a proper C++ program
i.e.
- // marks the beginning of a comment
- # marks the preprocessor directive
- using namespace std; is required to store the names of functions/variables in it
- int main() marks the begining of a function. a function can be be thought of as a group of one or more programming statements that collectively hs a name. this is the starting point of the program
- {} These are the opening and closing braces and mark the beginning and end of a program.
- ; This marks the end of the line and is like a "." in English
-
combined assignment operators
combined assignment operators, compound operators, and arithmetic assignment operators
combined assignment operators allow for the abbreviation of operations like x=x+1 to x += 1
+=, -=,*=,/=,%=/
-
binary operator
a binary operator performs tasks on two operands.
i.e. +,-,*,/,%
-
comment(single-line,multi-line,inline)
- // marks the beginning of a single line comment
- /* */ marks the beginning and end of a mult-line comment
- //can be used as an inline comment
-
bit
the eight smaller storage location of a byte are called bits. The term bit stands for binary digit. Bits are tiny electrical components that can hold either a positive or negative charge.
i.e. 1 and 0
-
const
a named constant is like a variable, but it's contents is read only and it cannot be changed while the program is running.
i.e. const double INTEREST_RATE = 0.069
-
bool
The Boolean data type is used to declare a variable whose value will be set as true or false. To declare such a value, you use the bool keyword. The variable can then be initialized with the starting value.
A Boolean constant is used to check the state of a variable, an expression, or a function, as true or false.
bool boolValue;
- boolValue=true
- cout << bool Value<< endl;
- boolValue = false;
- cout << boolValue << endl;
- return 0;
-
constant naming conventions
constants are named all upper case with underscore separating words
i.e. BACKGROUND_COLOR
-
byte
is a storage place in a computer's memory and is 8 bits
one byte can store like a letter or a digit
-
cout
the cout object is to display information on the to the computer's screen
cout is a stream object
the << is the stream insertion operator
i.e.
cout << "What is your name?";
OUTPUT
What is your name?
-
casting
allows for manual data type conversion
general format of a datat type cast expression is
static_cast<Datatype>(Value)
i.e.
- double number = 3.7;
- int val;
- val = static_cast<int>(number);
perMonth = static_cast<double>(books) / months;
-
data type promotion/demotion
promotion takes a smaller data type and promotes it to a larger data type. Demotion takes a larger data type and demotes it to a smaller data type.
for example a long double will be converted to an integer via math operators or type casting.
-
char
the char data type is used to store individual characters. A variable of the char data type can hold only one character at a time.
- i.e. char letter;
- after we declare a char variable we can assign a character to the letter variable.
i.e. letter = 'g';
you can not assign a string to the char variable.
- character literals are in single quotation marks,
- string literals are enclosed in double quotation marks.
-
#define
we can use this to define prepocessor macros
|
|