CBC2/CC101 Lesson 1

0.0(0)
studied byStudied by 5 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/27

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

28 Terms

1
New cards

Control statements

statements that alter the sequence of flow of instructions.

2
New cards

simple statement

Any single input statement, assignment and output statement is

3
New cards

a block or compound statement

A group of statement that are separated by semicolon and enclosed within curled braces { and } is called a

4
New cards

flow of control

The order in which statements are executed in a program is called

5
New cards

Selection statements

Iteration statements

C++ supports two basic control statements

6
New cards

Selection Statements

This statement allows us to select a statement or set of statements for execution based on some condition.

7
New cards

Selection Statements

also known as conditional statement

8
New cards

if statement

if – else statement

Nested – if statement

switch statement

The different selection statements

9
New cards

if statement

This is the simplest form of if statement,also called as one-way branching.

10
New cards

if – else statement

This structure helps to decide whether a set of statements should be executed or another set of statements should be executed.This statement is also called as two-way branching.

11
New cards

Nested if statement

If the statement of an if statement is another if statement then such an if statement is called as. t contains an if statement within another if statement.

12
New cards

if – else - if statement

This structure helps the programmer to decide the execution of a statement from multiple statements based on a condition.This statement is also called as multiple-way branch.

13
New cards

Switch Statement

C++ has built in multiple-branch selection statement.If there are more than two alternatives to be selected, multiple selection construct is used.is a bit peculiar within the C++ language because it uses labels instead of blocks

14
New cards

Iterative Constructs or Looping

are the statements that are used to repeatedly execute a sequence of statements until some condition is satisfied or a given number of times.

15
New cards

while loop

do while loop

for loop

three types of looping structures in C++.

16
New cards

while loop

This structure checks the condition at the beginning of the structure.The set of statements are executed again and again until the condition is true.

17
New cards

do while statements

This is a post-tested loop structure. This structure checks the condition at the end of the structure. The set of statements are executed again and again until the condition is true.

18
New cards

while: pre- tested looping structure, Minimum execution of loop is zero. Semi colon is not used.

do while: post tested looping structure,Minimum execution of loop is once. Semi colon is used.

Difference between while and do while loop:

19
New cards

for statement

is the fixed execution structure. This structure is usually used when we know in advance exactly how many times asset of statements is to be repeatedly executed again and again. This structure can be used as increment looping or decrement looping structure.

20
New cards

Jump statements or Transfer of control from within loop

Terminate the execution of loop.

Exiting a loop.

Half way through to skip the loop. All these can be done by using break, exit and continue statements.

21
New cards

break statement

You can use it to terminate a case in the switch statement.

You can also use it to force immediate termination of a loop like while, do-while and for, by passing the normal loop conditional test.

When encountered inside a loop, the loop is immediately terminated and program control resumes at the next statement.

22
New cards

exit( ) function

This function causes immediate termination of the entire program, forcing a return to the operating system. In effect, acts as if it were breaking out of the entire program.

23
New cards

return code

is used by the operating system and may be used by calling programs.

24
New cards

exit code of 0

means that the program finished normally and any other value means that some error or unexpected results happened.

25
New cards

continue statement

causes the program to skip the rest of the loop in the current iteration as if end of the statement block has been reached, causing it to jump to start of the following iteration.works somewhat like break statement.

26
New cards

goto statement

allows to makes an absolute jump to another point in the program. This statement execution causes an unconditional jump or transfer of control from one statement to the other statement with in a program ignoring any type of nesting limitations.

27
New cards

label

The destination is identified by a__which is then used as an argument for the goto statement.

28
New cards

colon

A label is made of a valid identifier followed by a