(2) Chapter 2: Introduction to C++ Language

0.0(0)
Studied by 0 people
call kaiCall Kai
Locked
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/154

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 10:11 PM on 7/22/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

155 Terms

1
New cards

Building data structures and algorithms

It requires communicating instructions to a computer, and an excellent way to perform such communication is using a high-level computer language.

2
New cards

high-level computer language

Building data structures and algortihms requires communicating instructions to a computer, and an excellent way to perform such communication is using a _____________.

3
New cards

C++

It is a powerful and flexible programming lanauge, which was designed to build upon the constructs of the C programming language. It is a superset of the C programming language.

4
New cards

C++

Extension to C language developed by Bjarne Stroustrup at Bell Labs

5
New cards

Bjarne Stroustrup, Bell Labs

Who developed and where was C++ developed?

6
New cards

C++ Program

It is a collection of commands, which tell the computer to do "something".

7
New cards

C++ Source code

A C++ program is a collection of commands, which tell the computer to do "something". This collection of commands is usually called ____________.

8
New cards

Commands

are either "functions" or "keywords".

9
New cards

Keywords

are a basic building block of the language.

10
New cards

Functions

are, in fact, usually written in terms of simpler functions.

11
New cards

Reasons to Learn C++

❑ Popularity and High Salary

❑ Abundant Library Support

❑ Large Community

❑ Databases

❑ Operating Systems

❑ Compilers

❑ Web Browsers

❑ Graphics

❑ Embedded Systems

❑ Portable

12
New cards

Data Type

Classification that specifies which type of value a variable has and what type of mathematical, relational, or logical operations can be applied to it without causing an error.

13
New cards

Data Type

It has Primitive and Composite

14
New cards

Primitive Data Type, Composite Data Type

These are the two types of Data types in C++

15
New cards

Primitive Data Type

This data type only reads only one value, digit, or character.

16
New cards

Primitive Data Type

Example of this are: int = 3, char = ‘k’, float = 23.5, double = 23.0

17
New cards

Composite Data Type

It consists of multiple values, digits, or characters.

18
New cards

Composite Data Type

Example of this are: string, arrays, etc.

19
New cards

Arrays

collection of homogenous data types

20
New cards

Vectors

mathematical representations of arrays

21
New cards

Strings

combination of characters

22
New cards

Arithmetic Operators

Operators used for mathematical calculations.

23
New cards

+

adds two operands

24
New cards

-

Subtract

25
New cards

*

Multiples both operands

26
New cards

/

Divides numerator by de-numerator

27
New cards

%

gives the remainder of after an integer division

28
New cards

modulus

%

29
New cards

++

increases integer value by one

30
New cards

increment operator

++

31
New cards

decrement operator

--

32
New cards

Relational Operators

Operators used to compare values.

33
New cards

==

Checks if the values of two operands are equal or not, if yes then condition becomes true.

34
New cards

!=

Checks if the values of two operands are equal or not, if values are not equal then condition becomes true.

35
New cards

>

Checks if the value of left operand is greater than the value of right operand, if yes then condition becomes true.

36
New cards

<

Checks if the value of left operand is greater than or equal to the value of right operand, if yes then condition becomes true.

37
New cards

>=

Checks if the value of left operand is greater than or equal to the value of right operand, if yes then condition becomes true.

38
New cards

<=

Checks if the value of left operand is less than or equal to the value of right operand, if yes then condition becomes true.

39
New cards

Logical Operators

Operators used to combine or modify conditions.

40
New cards

Logical AND Operator

If both the operands are non-zero, then condition becomes true.

41
New cards

Logical AND Operator

Represented by &&

42
New cards

Logical OR Operator

If any of the two operands is non-zero, then condition becomes true.

43
New cards

Logical OR Operator

Represented by ||

44
New cards

Logical NOT Operator

Use to reverses the logical state of its operand. If a condition is true, then Logical NOT operator will make false.

45
New cards

Logical NOT Operator

Represented by !

46
New cards

Bitwise Operators

Operators used to perform operations at the bit level.

47
New cards

Binary AND Operator

  • copies a bit to the result if it exists in both operands.

  • &

48
New cards

Binary AND Operator

It gives the binary bit of a value.

49
New cards

Binary OR Operator

  • copies a bit if it exists in either operand.

  • |

50
New cards

Binary OR Operator

It has rules of:
1 and 1 = 1
0 and 0 = 0
1 and 0 = 0

51
New cards

Binary XOR Operator

  • copies the bit if it is set in one operand but not both.

  • ^

52
New cards

Binary XOR Operator

It has rules of:
1 and 1 = 0
0 and 0 = 0
1 and 0 = 1

53
New cards

Binary Ones Complement Operator

  • is unary and has the effect of 'flipping' bits.

  • ~

54
New cards

Binary Ones Complement Operator

It flips the binary bits of a value.

55
New cards

Binary Left Shift Operator

  • The left operands value is moved left by the number of bits specified by the right operand.

  • «

56
New cards

Binary Right Shift Operator

  • The left operands value is moved right by the number of bits specified by the right operand.

  • »

57
New cards

Assignment Operators

Operators used to assign values to variables.

58
New cards

=

Simple assignment operator, Assigns values from right side operands to left side operand.

59
New cards

Add AND assignment operator

  • It adds right operand to the left operand and assign the result to left operand

  • +=

60
New cards

Subtract AND assignment operator

  • It subtracts right operand from the left operand and assign the result to left operand.

  • -=

61
New cards

Multiply AND assignment operator

  • It multiplies right operand with the left operand and assign the result to left operand.

  • *=

62
New cards

Divide AND assignment operator

  • It divides left operand with the right operand and assign the result to left operand.

  • /=

63
New cards

Modulus AND assignment operator

  • It takes modulus using two operands and assign the result to left operand.

  • %=

64
New cards

Left shift AND assignment operator.

<<=

65
New cards

Right shift AND assignment operator.

>>=

66
New cards

Bitwise AND assignment operator.

&=

67
New cards

Bitwise exclusive OR and assignment operator

^=

68
New cards

Bitwise inclusive OR and assignment operator.

|=

69
New cards

Misc Operators

Operators that do not fall under other categories.

70
New cards

sizeof

returns the size of a variable. For example, sizeof(a) where ‘a’ is an integer and will return 4.

71
New cards

sizeof

it gives the size of bytes that a variable takes up.

72
New cards

sizeof

int main() {
    float b = 10;
    cout << sizeof(b) << " with value of: " << b <<endl;
    return 0;

73
New cards

condition ternary operator

it is considered the “shortcut” or easier way of an if-else statement.

74
New cards

conditional ternary operator

if condition is true, then it returns value of X, otherwise returns value of Y.

75
New cards

condition ternary operator

represented by ? x : y

76
New cards

X

In condition ternary operator ? x : y, what is returned if the condition is true?

77
New cards

Y

In condition ternary operator ? x : y, what is returned if the condition is false?

78
New cards

condition ternary operator

int main() {
    int a = 10, b = 5, c = 0, d = 1;

    int result = (a == b) ? d : c;
    cout << "Result: " << result << endl;

    return 0;

79
New cards

address and pointer

represented by *ptr

80
New cards

address and pointer

int main() {
    int x = 10;
    int *ptr = &x;

    cout << "Address: " << &x << endl;
    cout << "Value: " << *ptr << endl;

    return 0;

81
New cards

comma

causes a sequence of operations to be performed.

82
New cards

comma

represented by ,

83
New cards

comma

the value of the entire _______ expression is the value of the last expression of the comma-separated list.

84
New cards

dot and arrow

it is considered the member operators.

85
New cards

dot

represented by .

86
New cards

arrow

represented by →

87
New cards

member operators

are used to reference individual members of classes, structures, and unions.

88
New cards

dot and arrow

struct Student {
    int id; //102
};

int main() {
    Student s;
    s.id = 101;

    Student *ptr = &s;
    ptr->id = 102;

    cout << s.id << endl;

    return 0;
  1. Set the class, struct Student including the variable int id;

  2. Establish the class Student as the variable name s

  3. s.id tells that the class Student has the variable int id

89
New cards

structure

struct Student {
    int id; //102
};

90
New cards

struct

is used to create a custom data type.

91
New cards

members

inside a structure, you define variable or called ______.

92
New cards

casting operators

convert one data type to another. for example, int(2.200) would return 2.

93
New cards

casting

int main() {
    float num = 3.9;
    int result = (int)num;

    cout << result << endl;
    return 0;

94
New cards

Pointer operator &

returns the address of a variable in HEXADECIMAL form. For example &a; will give actual address of the variable.

95
New cards

Pointer operator *

is pointer to a variable. For example *var; will pointer to a variable var.

96
New cards

semicolon

a statement terminator.

97
New cards

semicolon

each individual statement must be ended with a __________-.

98
New cards

semicolon

It indicates the end of one logical entity.

99
New cards

blocks

is a set of logically connected statements that are surrounded by opening and closing braces.

100
New cards

identifier

is a name used to identify a variable, function, class, module, or any other user-defined item.