This document discusses various types of flow control in C++ programming. It covers sequential flow, conditional statements like if-else and switch case. It also discusses different types of loops - for, while, do-while and nested loops. The key aspects of each conditional statement and loop like syntax, execution flow and examples are explained in detail.
Like many other procedural languages, C++ provides different forms of statements for different purposes. Declaration statements are used for defining variables. Assignment-like statements are used for simple, algebraic computations. Branching statements are used for specifying alternate paths of execution, depending on the outcome of a logical condition. Loop statements are used for specifying computations which need to be repeated until a certain logical condition is satisfied. Flow control statements are used to divert the execution path to another part of the program. We will discuss these in turn.
Like many other procedural languages, C++ provides different forms of statements for different purposes. Declaration statements are used for defining variables. Assignment-like statements are used for simple, algebraic computations. Branching statements are used for specifying alternate paths of execution, depending on the outcome of a logical condition. Loop statements are used for specifying computations which need to be repeated until a certain logical condition is satisfied. Flow control statements are used to divert the execution path to another part of the program. We will discuss these in turn.
A cluster is an accumulation of factors of a similar sort that are alluded to through a typical name. A particular component in a cluster is gotten to by a file. In C, all clusters comprise of coterminous memory areas.
Introduction to control structure in C Programming Language include decision making (if statement, if..else statement, if...else if...else statement, nested if...else statement, switch...case statement), Loop(for loop, while loop, do while loop, nested loop) and using keyword(break, continue and goto)
A cluster is an accumulation of factors of a similar sort that are alluded to through a typical name. A particular component in a cluster is gotten to by a file. In C, all clusters comprise of coterminous memory areas.
Introduction to control structure in C Programming Language include decision making (if statement, if..else statement, if...else if...else statement, nested if...else statement, switch...case statement), Loop(for loop, while loop, do while loop, nested loop) and using keyword(break, continue and goto)
● Introduction to Control Structures
Branching structures
● If statement, If-else statement, Nested if-else, else-if Ladder
● Switch statement
Looping Structures
● For loop, While loop, Do while loop
● break and continue
The control statements enable us to specify the order in which the various instructions in a program are to be executed by the computer. They determine the flow of control in a program.
There are 4 types of control statements in C. They are:
a) Sequence control statements
b) Decision control statements or conditional statement
c) Case-control statements
d) Repetition or loop control statements
The objective of the Level 5 Diploma in Information Technology is to provide learners with an excellent foundation for a career in a range of organisations. It designed to ensure that each learner is ‘business ready’: a confident, independent thinker with a detailed knowledge of Information Technology, and equipped with the skills to adapt rapidly to change.
A while loop in C programming
repeatedly executes a target
statement as long as a given
condition is true.
A while loop in C programming
repeatedly executes a target
statement as long as a given
condition is true.
NETWORKING AND COMMUNICATION || SLIDE 1 || TOPOLOGY AND PLACEMENT OF DEVICES|...AAKASH KUMAR
IN THIS PPT I HAVE COVERED THE LAST QUESTION OF CBSE CS BOARD EXAM PAPER ABOUT TOPOLOGY AND PLACEMENT OF DEVICES FROM THE CHAPTER COMMUNICATION & NETWORK CONCEPTS.
tips and tricks to solve inheritance question easily of class 12th computer science.
don't forgot to watch my youtube video on this topic
https://youtu.be/WvWsx4bPPzU
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...Levi Shapiro
Letter from the Congress of the United States regarding Anti-Semitism sent June 3rd to MIT President Sally Kornbluth, MIT Corp Chair, Mark Gorenberg
Dear Dr. Kornbluth and Mr. Gorenberg,
The US House of Representatives is deeply concerned by ongoing and pervasive acts of antisemitic
harassment and intimidation at the Massachusetts Institute of Technology (MIT). Failing to act decisively to ensure a safe learning environment for all students would be a grave dereliction of your responsibilities as President of MIT and Chair of the MIT Corporation.
This Congress will not stand idly by and allow an environment hostile to Jewish students to persist. The House believes that your institution is in violation of Title VI of the Civil Rights Act, and the inability or
unwillingness to rectify this violation through action requires accountability.
Postsecondary education is a unique opportunity for students to learn and have their ideas and beliefs challenged. However, universities receiving hundreds of millions of federal funds annually have denied
students that opportunity and have been hijacked to become venues for the promotion of terrorism, antisemitic harassment and intimidation, unlawful encampments, and in some cases, assaults and riots.
The House of Representatives will not countenance the use of federal funds to indoctrinate students into hateful, antisemitic, anti-American supporters of terrorism. Investigations into campus antisemitism by the Committee on Education and the Workforce and the Committee on Ways and Means have been expanded into a Congress-wide probe across all relevant jurisdictions to address this national crisis. The undersigned Committees will conduct oversight into the use of federal funds at MIT and its learning environment under authorities granted to each Committee.
• The Committee on Education and the Workforce has been investigating your institution since December 7, 2023. The Committee has broad jurisdiction over postsecondary education, including its compliance with Title VI of the Civil Rights Act, campus safety concerns over disruptions to the learning environment, and the awarding of federal student aid under the Higher Education Act.
• The Committee on Oversight and Accountability is investigating the sources of funding and other support flowing to groups espousing pro-Hamas propaganda and engaged in antisemitic harassment and intimidation of students. The Committee on Oversight and Accountability is the principal oversight committee of the US House of Representatives and has broad authority to investigate “any matter” at “any time” under House Rule X.
• The Committee on Ways and Means has been investigating several universities since November 15, 2023, when the Committee held a hearing entitled From Ivory Towers to Dark Corners: Investigating the Nexus Between Antisemitism, Tax-Exempt Universities, and Terror Financing. The Committee followed the hearing with letters to those institutions on January 10, 202
How to Make a Field invisible in Odoo 17Celine George
It is possible to hide or invisible some fields in odoo. Commonly using “invisible” attribute in the field definition to invisible the fields. This slide will show how to make a field invisible in odoo 17.
Operation “Blue Star” is the only event in the history of Independent India where the state went into war with its own people. Even after about 40 years it is not clear if it was culmination of states anger over people of the region, a political game of power or start of dictatorial chapter in the democratic setup.
The people of Punjab felt alienated from main stream due to denial of their just demands during a long democratic struggle since independence. As it happen all over the word, it led to militant struggle with great loss of lives of military, police and civilian personnel. Killing of Indira Gandhi and massacre of innocent Sikhs in Delhi and other India cities was also associated with this movement.
Acetabularia Information For Class 9 .docxvaibhavrinwa19
Acetabularia acetabulum is a single-celled green alga that in its vegetative state is morphologically differentiated into a basal rhizoid and an axially elongated stalk, which bears whorls of branching hairs. The single diploid nucleus resides in the rhizoid.
Normal Labour/ Stages of Labour/ Mechanism of LabourWasim Ak
Normal labor is also termed spontaneous labor, defined as the natural physiological process through which the fetus, placenta, and membranes are expelled from the uterus through the birth canal at term (37 to 42 weeks
Safalta Digital marketing institute in Noida, provide complete applications that encompass a huge range of virtual advertising and marketing additives, which includes search engine optimization, virtual communication advertising, pay-per-click on marketing, content material advertising, internet analytics, and greater. These university courses are designed for students who possess a comprehensive understanding of virtual marketing strategies and attributes.Safalta Digital Marketing Institute in Noida is a first choice for young individuals or students who are looking to start their careers in the field of digital advertising. The institute gives specialized courses designed and certification.
for beginners, providing thorough training in areas such as SEO, digital communication marketing, and PPC training in Noida. After finishing the program, students receive the certifications recognised by top different universitie, setting a strong foundation for a successful career in digital marketing.
Embracing GenAI - A Strategic ImperativePeter Windle
Artificial Intelligence (AI) technologies such as Generative AI, Image Generators and Large Language Models have had a dramatic impact on teaching, learning and assessment over the past 18 months. The most immediate threat AI posed was to Academic Integrity with Higher Education Institutes (HEIs) focusing their efforts on combating the use of GenAI in assessment. Guidelines were developed for staff and students, policies put in place too. Innovative educators have forged paths in the use of Generative AI for teaching, learning and assessments leading to pockets of transformation springing up across HEIs, often with little or no top-down guidance, support or direction.
This Gasta posits a strategic approach to integrating AI into HEIs to prepare staff, students and the curriculum for an evolving world and workplace. We will highlight the advantages of working with these technologies beyond the realm of teaching, learning and assessment by considering prompt engineering skills, industry impact, curriculum changes, and the need for staff upskilling. In contrast, not engaging strategically with Generative AI poses risks, including falling behind peers, missed opportunities and failing to ensure our graduates remain employable. The rapid evolution of AI technologies necessitates a proactive and strategic approach if we are to remain relevant.
Introduction to AI for Nonprofits with Tapp NetworkTechSoup
Dive into the world of AI! Experts Jon Hill and Tareq Monaur will guide you through AI's role in enhancing nonprofit websites and basic marketing strategies, making it easy to understand and apply.
3. FLOW OF CONTROL
IT REFERS TO THE FLOW IN WHICH A
PROGRAM EXECUTION TAKES PLACE.
AAKASH KAUSHIK
9891983083,9289817971
4. FLOW OF CONTROL
1.)Sequential
IN this each statement of a program is executed
sequentially i.e, one after another
2.)Conditional/Decision Making
3.)Iterations/Looping
AAKASH KAUSHIK
9891983083,9289817971
7. It takes a condition in parenthesis and a code block .If
the condition will results into true the code block will
execute or if the condition will false the code block will
be skipped.
The general form of a simple if statement is
if (test expression)
{
statement-block;
}
statement-x;
IF CONDITION
AAKASH KAUSHIK
9891983083,9289817971
8. It is the extension of simple if statement. It contains an
additional else block also. If the condition will results into
true the if code block will execute or if the condition will
false the else code block will execute.
if (test expression)
{
True-block statement(s)
}
else
{
False-block statement(s)
}
statement-x
IF ELSE CONDITION
AAKASH KAUSHIK
9891983083,9289817971
10. There is another way of putting ifs together when
multiple decisions are involved. A multipath decision
is a chain of ifs in which the statement associated
with each else is an if. It takes the following general
form:
if (condition 1)
statement 1 ;
else if (condition 2)
statement 2;
else if (condition n)
statement n;
else
default statement;
statement x;
THE ELSE IF LADDER
AAKASH KAUSHIK
9891983083,9289817971
11. If the condition-1 is true statement-1 will be
executed; otherwise it continues to perform the
other test condition-2 then condition-3 and so on
Until any condition results into true otherwise by
default else block i.e, default-statement will get
executed and control will be transferred to
statement –X.
The else block is Optional and Default.
THE ELSE IF LADDER
AAKASH KAUSHIK
9891983083,9289817971
13. Nested if also known as if within if or
condition within condition. When a series
of decisions are involved, we may have to
use more than one if...else statements in
nested form i.e., body of an if or else part
will also be a condition(if..else).
NESTED IF
AAKASH KAUSHIK
9891983083,9289817971
14. if (test condition1)
{
if (test condition 2)
{
statement-1;
}
else
{
statement-2;
}
}
else
{
statement-3;
}
statement-x;
NESTED IF
AAKASH KAUSHIK
9891983083,9289817971
If condition-1 will true
then its body will execute
and condition-2 is tested
if it will true statement-1
will execute otherwise
statement-2 will execute
or if condition-1 will false
then as a result
statement-3 will execute
and in all the cases
control will be transferred
to statement-X.
16. C++ Provides a multiple-branch selection
statement known as SWITCH. This selection
statement tests the value of an expression against
a list of integer or character constants. When a
match is found, the statement associated with that
constant are executed if no match is found then
the default statement gets executed.
THE SWITCH STATEMENT
AAKASH KAUSHIK
9891983083,9289817971
17. switch(expression)
{
case constant 1: statement sequence 1;
break;
case constant 2: statement sequence 2;
break;
case constant 3: statement sequence 3;
break;
case constant n-1: statement sequence n-1;
break;
default : statement sequence n;
}
//default statement is optional
SYNTAX:-
AAKASH KAUSHIK
9891983083,9289817971
18. AAKASH KAUSHIK
9891983083,9289817971
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int dow;
cout<<"Enter weekday number(1-7)";
cin>>dow;
switch(dow)
{
case 1:cout<<"MONDAY";
break;
case 2:cout<<"TUESDAY";
break;
case 3:cout<<"WEDNESDAY";
break;
case 4:cout<<"THURSDAY";
break;
case 5:cout<<"FRIDAY";
break;
case 6:cout<<"SATURDAY";
break;
case 7:cout<<"SUNDAY";
break;
default:cout<<"wrong number of day";
break;
}
getch();
}
Example of switch
19. The break statement used under switch is one of
C++ jump statements . whenever a case
constant is matched with expression in the
switch that particular part starts execution and
lasts until any break statement is encountered or
until the end of switch. Due to break statements
the program execution jumps to line following
the switch i.e., outside the body of the switch
statement otherwise it will execute all the
statements following the matched case in the
switch.
Usage of break in switch
AAKASH KAUSHIK
9891983083,9289817971
21. Switch v/s if-else..
If else..
It can handle logical or
relational expressions i.e.,
multiple conditions.
If else is more versatile
as it can handle ranges.
If else can work upon int
, char & floating point
data also.
If else construction lets
you use a series of
expressions that may
involve unrelated
variables
Switch
Switch can only test for
equality
Switch case label must be
only a single value.
Switch works only with
int & char data types.
The switch statement
selects its branches by
testing the value of same
variable(against a set of
constants)
AAKASH KAUSHIK
9891983083,9289817971
22. Switch v/s if-else..
If else..
It can handle logical or
relational expressions i.e.,
multiple conditions.
If else is more versatile
as it can handle ranges.
If else can work upon int
, char & floating point
data also.
If else construction lets
you use a series of
expressions that may
involve unrelated
variables
Switch
Switch can only test for
equality
Switch case label must be
only a single value.
Switch works only with
int & char data types.
The switch statement
selects its branches by
testing the value of same
variable(against a set of
constants)
AAKASH KAUSHIK
9891983083,9289817971
25. PARTS OF LOOP
AAKASH KAUSHIK
9891983083,9289817971
1.)Initialization Expression- It is the initialization
Statement of the Control variable( variable used to
control the loop) .i.e., The value from which loop will
start it’s execution
2.)Test Expression/Condition - the condition up to which
loop will keep on execution. If the condition results true
loop-body will execute again otherwise the loop is
terminated
3.)Updation- the loop variable is incremented or
decremented according to the needs for which the next
iteration will be performed.
4.)Body of loop- Code Block/Statements need to be
executed repeatedly until the conditions results true.
28. FOR LOOP EXECUTION SEQUENCE
AAKASH KAUSHIK
9891983083,9289817971
INTIALIZATION
CONDITION
CHECKING
TERMINATE
LOOP
BODY
EXECUTION UPDATION
FALSE
T
R
U
E
START
30. WHILE LOOP EXECUTION SEQUENCE
AAKASH KAUSHIK
9891983083,9289817971
INTIALIZATION
CONDITION
CHECKING
TERMINATE
LOOPFALSE
T
R
U
E
START
BODY
EXECUTION
+
UPDATION
31. Syntax:-
Initialization
do
{
- - - - -
- - - - -
- - - - -
}
While(condition)
DO WHILE LOOP
AAKASH KAUSHIK
9891983083,9289817971
BODY OF LOOP
+
UPDATION
32. DO-WHILE LOOP EXECUTION SEQUENCE
AAKASH KAUSHIK
9891983083,9289817971
INTIALIZATION
BODY
EXECUTION
+
UPDATION
CONDITION
CHECKING
START
TERMINATE
LOOP
F
A
L
S
E
T
R U E