1/123
A comprehensive set of 143 vocabulary flashcards covering key C++ concepts, variables, operators, program flow, formatting manipulators, formulas, and common error types based on the lecture notes.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
Variable
A named storage location used to hold a value.
Data Type
Tells C++ what kind of value a variable stores.
int Data Type
Stores whole numbers without decimal values.
double Data Type
Stores numbers that can contain decimal values.
bool Data Type
Stores true or false values.
char Data Type
Stores a single character.
string Data Type
Stores text or a sequence of characters.
Variable Declaration
Creating a variable by giving its data type and name.
Variable Initialization
Creating a variable and giving it an initial value.
Assignment
Changing the value stored in an existing variable.
= Operator
Assigns or stores a value in a variable.
== Operator
Compares two values to see if they are equal.
Difference Between = and ==
= assigns a value; == compares values.
cin
Receives input from the user.
cout
Displays output to the screen.
cin >> variable
Receives user input and stores it in the variable.
cout << variable
Displays the value stored in the variable.
cin Operator
Uses >> for input.
cout Operator
Uses << for output.
cin and cout Arrow Memory Rule
cin uses >> for input; cout uses << for output.
endl
Moves output to the next line.
Constant
A value that cannot be changed after initialization.
const Keyword
Creates a constant in C++.
Named Constants Purpose
They make code clearer and easier to update consistently.
Named Constant Naming Convention
Written using uppercase letters with underscores.
Named Constant Example
const double TAX_RATE = 0.08;
Regular Variable Naming Convention
Commonly named using lowercase or camelCase.
camelCase Example
purchasePrice
int price = 10;
Creates an integer variable named price with value 10.
double price = 12.75;
Creates a decimal variable named price with value 12.75.
score = 95;
Changes the existing value of score to 95.
score == 95
Checks whether score is equal to 95.
Adds values.
Subtracts values.
Multiplies values.
/ Operator
Divides values.
% Operator
Gives the remainder after division.
29 % 6
Evaluates to 5.
10 % 3
Evaluates to 1.
20 % 5
Evaluates to 0.
Integer Division
Division where both operands are integers and the decimal is discarded.
7 / 2 (Integer Division)
Evaluates to 3 when both values are int.
11 / 4 (Integer Division)
Evaluates to 2 when both values are int.
7.0 / 2
Evaluates to 3.5.
Decimal Output Condition in Division
Division produces a decimal when at least one operand is a floating-point value.
Operator Precedence
The rules determining which operations happen first.
First Step in Expression Evaluation
Parentheses occur first in an expression.
Second Step in Expression Evaluation
Multiplication, division, and modulus occur after parentheses.
Third Step in Expression Evaluation
Addition and subtraction occur after *, /, and %.
Equal Precedence Evaluation Order
Operations with equal precedence are evaluated from left to right.
5 + 3 * 4
Evaluates to 17.
(10 - 4) * 2 + 3
Evaluates to 15.
18 - 6 / 3 + 4 * 2
Evaluates to 24.
Operator
Greater than.
Less than.
= Operator
Greater than or equal to.
Less than or equal to.
== Relational Operator
Equal to.
!= Operator
Not equal to.
Relational Operator
An operator used to compare values.
&& Operator
AND; both conditions must be true.
|| Operator
OR; at least one condition must be true.
Logical Operator
An operator used to combine or work with conditions.
if Statement
Runs code when a condition is true.
else if Statement
Checks another condition if the previous condition was false.
else Statement
Runs when none of the previous conditions are true.
if (age >= 60)
Checks whether age is 60 or older.
choice >= 1 && choice <= 3
Means choice must be between 1 and 3 inclusive.
choice == 1 || choice == 2
Means choice can be either 1 or 2.
Boolean Condition
A condition that evaluates to true or false.
bool Values
Can represent true or false.
bool Input 1
Usually represents true or yes.
bool Input 0
Usually represents false or no.
Syntax Error
An error caused by breaking C++ grammar or syntax rules.
Logic Error
An error where the program runs but produces an incorrect result.
Missing Semicolon
A common syntax error.
Wrong Mathematical Formula
A type of logic error.
Program Compiles but Gives Wrong Answer
Classified as a logic error.
Code Cannot Compile Due to Invalid Syntax
Classified as a syntax error.
Header iostream
Header used for cin and cout.
Header iomanip
Header used for formatting tools.
using namespace std
Lets you use standard names like cin and cout without std::.
Provides input/output tools such as cin and cout.
Provides formatting tools such as setw and setprecision.
Provides the string data type.
main() Function
The function where a C++ program begins executing.
return 0;
Means the main function completed successfully.
Comment
Text ignored by the compiler that explains code.
Single-line Comment Start
Begins with //.
Comments Purpose
They explain code and make programs easier to understand.
fixed Stream Manipulator
Displays floating-point values in fixed decimal notation.
setprecision(2) with fixed
Displays exactly 2 digits after the decimal.
setprecision(3) with fixed
Displays exactly 3 digits after the decimal.
7.5 with fixed and setprecision(2)
Becomes 7.50.
4.2 with fixed and setprecision(3)
Becomes 4.200.
setw(10)
Sets a minimum field width of 10 for the next output item.
setw(10) Decimal Misconception
Does not mean 10 decimal places; it controls field width and spacing.
setw Control Scope
Controls output spacing and alignment.
setprecision Control Scope
Controls the number of decimal places when used with fixed.
left Manipulator
Aligns output to the left of its field when used with setw.