The document discusses various control structures in C++ including decision making statements like if, else if, switch, and loops like for, while, and do-while. It provides examples and explanations of how each control structure directs the flow of a program based on conditions or iterations. Specific points covered include simple if statements, if-else, nested if-else, else if ladders, switch statements, break statements, for loops, while loops, and do-while loops. Flowcharts are also provided to illustrate the logic flow for some of the control structures.
#loops, #c, #program, #loops in c, #c loops, #loops introduction, #while and do while loop, #for loop in c programming, #loops in c programming, #c programming loop, #c loop programs, #looping structure in c, #looping
This will explain different type of for loop, their syntax and working.
It is very small side to quickly demonstrate for loop.
It was developed to present in class as an Semester activity.
loops play a vital role in any programming language, they allow the programmer to write more readable and effective code. The looping concept also allows us to reduce the number of lines.
#loops, #c, #program, #loops in c, #c loops, #loops introduction, #while and do while loop, #for loop in c programming, #loops in c programming, #c programming loop, #c loop programs, #looping structure in c, #looping
This will explain different type of for loop, their syntax and working.
It is very small side to quickly demonstrate for loop.
It was developed to present in class as an Semester activity.
loops play a vital role in any programming language, they allow the programmer to write more readable and effective code. The looping concept also allows us to reduce the number of lines.
C Programming - Decision making, LoopingMURALIDHAR R
Execution of a statement or set of statement repeatedly is called as looping.
The loop may be executed a specified number of times and this depends on the satisfaction of a test condition.
A program loop is made up of two parts one part is known as body of the loop and the other is known as control condition.
Depending on the control condition statement the statements within the loop may be executed repeatedly.
Depending on the position of the control statement in the loop, a control structure may be classified either as an entry controlled loop or as an exit controlled loop.
Entry Controlled Loop:
When the control statement is placed before the body of the loop then such loops are called as entry controlled loops.
If the test condition in the control statement is true then only the body of the loop is executed.
If the test condition in the control statement is not true then the body of the loop will not be executed. If the test condition fails in the first checking itself the body of the loop will never be executed.
The Decision Control Structure - C Programming. C has three major decision making instructions—the if statement, the if-else statement, and the switch statement.
this slide is for to understand the conditions which are applied in C++ programming language. I hope u would understand better by viewing this presentation.
C Programming - Decision making, LoopingMURALIDHAR R
Execution of a statement or set of statement repeatedly is called as looping.
The loop may be executed a specified number of times and this depends on the satisfaction of a test condition.
A program loop is made up of two parts one part is known as body of the loop and the other is known as control condition.
Depending on the control condition statement the statements within the loop may be executed repeatedly.
Depending on the position of the control statement in the loop, a control structure may be classified either as an entry controlled loop or as an exit controlled loop.
Entry Controlled Loop:
When the control statement is placed before the body of the loop then such loops are called as entry controlled loops.
If the test condition in the control statement is true then only the body of the loop is executed.
If the test condition in the control statement is not true then the body of the loop will not be executed. If the test condition fails in the first checking itself the body of the loop will never be executed.
The Decision Control Structure - C Programming. C has three major decision making instructions—the if statement, the if-else statement, and the switch statement.
this slide is for to understand the conditions which are applied in C++ programming language. I hope u would understand better by viewing this presentation.
As Europe's leading economic powerhouse and the fourth-largest hashtag#economy globally, Germany stands at the forefront of innovation and industrial might. Renowned for its precision engineering and high-tech sectors, Germany's economic structure is heavily supported by a robust service industry, accounting for approximately 68% of its GDP. This economic clout and strategic geopolitical stance position Germany as a focal point in the global cyber threat landscape.
In the face of escalating global tensions, particularly those emanating from geopolitical disputes with nations like hashtag#Russia and hashtag#China, hashtag#Germany has witnessed a significant uptick in targeted cyber operations. Our analysis indicates a marked increase in hashtag#cyberattack sophistication aimed at critical infrastructure and key industrial sectors. These attacks range from ransomware campaigns to hashtag#AdvancedPersistentThreats (hashtag#APTs), threatening national security and business integrity.
🔑 Key findings include:
🔍 Increased frequency and complexity of cyber threats.
🔍 Escalation of state-sponsored and criminally motivated cyber operations.
🔍 Active dark web exchanges of malicious tools and tactics.
Our comprehensive report delves into these challenges, using a blend of open-source and proprietary data collection techniques. By monitoring activity on critical networks and analyzing attack patterns, our team provides a detailed overview of the threats facing German entities.
This report aims to equip stakeholders across public and private sectors with the knowledge to enhance their defensive strategies, reduce exposure to cyber risks, and reinforce Germany's resilience against cyber threats.
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...Subhajit Sahu
Abstract — Levelwise PageRank is an alternative method of PageRank computation which decomposes the input graph into a directed acyclic block-graph of strongly connected components, and processes them in topological order, one level at a time. This enables calculation for ranks in a distributed fashion without per-iteration communication, unlike the standard method where all vertices are processed in each iteration. It however comes with a precondition of the absence of dead ends in the input graph. Here, the native non-distributed performance of Levelwise PageRank was compared against Monolithic PageRank on a CPU as well as a GPU. To ensure a fair comparison, Monolithic PageRank was also performed on a graph where vertices were split by components. Results indicate that Levelwise PageRank is about as fast as Monolithic PageRank on the CPU, but quite a bit slower on the GPU. Slowdown on the GPU is likely caused by a large submission of small workloads, and expected to be non-issue when the computation is performed on massive graphs.
Adjusting primitives for graph : SHORT REPORT / NOTESSubhajit Sahu
Graph algorithms, like PageRank Compressed Sparse Row (CSR) is an adjacency-list based graph representation that is
Multiply with different modes (map)
1. Performance of sequential execution based vs OpenMP based vector multiply.
2. Comparing various launch configs for CUDA based vector multiply.
Sum with different storage types (reduce)
1. Performance of vector element sum using float vs bfloat16 as the storage type.
Sum with different modes (reduce)
1. Performance of sequential execution based vs OpenMP based vector element sum.
2. Performance of memcpy vs in-place based CUDA based vector element sum.
3. Comparing various launch configs for CUDA based vector element sum (memcpy).
4. Comparing various launch configs for CUDA based vector element sum (in-place).
Sum with in-place strategies of CUDA mode (reduce)
1. Comparing various launch configs for CUDA based vector element sum (in-place).
2. ❏ Control structures
❏ A Program is nothing but a set of statements written in sequential order.
❏ These statements are executed one after the other
❏ Sometimes it may happen that the programmer requires to alter the flow of
execution, or to perform the same operation for fixed iterations or whenever
the condition does not satisfy. In such a situation the programmer uses the
control structure.
❏ There are various control structures supported by C++. Programs which use
such (one or three) control structures are said to be structured programs.
1
3. ❏ Decision making in C++
❏ Decision making is about deciding the order of execution of statements
based on certain conditions or repeat a group of statements until certain
specified conditions are met.
❏ C++ handles decision-making by supporting the following statements,
❏ if statement
❏ switch statement
❏ conditional operator statement
❏ goto statement
2
4. ❏ Decision making with if statement
❏ The if statement may be implemented in different forms depending on the
complexity of conditions to be tested. The different forms are,
❏ Simple if statement
❏ If....else statement
❏ Nested if....else statement
❏ else if ladder
3
5. ❏ Simple if statement
❏ The general form of a simple if statement is,
if (expression)
{
statement-inside;
{
statement -outside;
❏ If the expression is true, then 'statement-inside' it will be executed, otherwise
'statement-inside' is skipped and only 'statement-outside' is executed.
4
6. ❏ Example
❏ #include< iostream.h>
int main( )
{
int x,y;
x=15;
y=13;
if (x > y )
{
cout << "x is greater than y";
getch();
}
}
5
7. ❏ If...else statement
❏ The general form of a simple if...else statement is,
if( expression )
{
Statement-block 1;
{
else
{
statement-block 2;
}
❏ If the 'expression' is true, the 'statement-block 1' is executed, else 'statement-block 1'
is skipped and 'statement-block 2' is executed.
6
9. ❏ Example
❏ void main( )
{
int x,y;
x=15;
y=18;
if (x > y )
{
cout << "x is greater than y";
}
else
cout << "y is greater than x";
}
}
8
10. ❏ Nested if….else statement
❏ The general form of a nested if...else statement is,
if( expression )
{
if( expression1 )
{
Statement-block 1;
}
else
{
statement-block 2;
}
}
else
{
statement-block 3;
}
❏ if 'expression' is false the
'statement-block 3' will be executed,
otherwise it continues to perform the
test for 'expression 1' . If the
'expression 1' is true the 'statement-
block 1' is executed otherwise
'statement- block 2' is executed.
9
11. ❏ Switch statement
❏ switch statement :- this is multiple conditional statement switch check the
condition if condition is true then perform the statement and totally depend
upon the value of variable otherwise perform the default statement
❏ Prototype :- switch < expression>
Case <statement 1 >
Case <statement 2 >
Case <statement 3 >
Case <statement 4 >
default <statement >
10
12. ❏ The jump statement
❏ C/C++ has four statements that perform an unconditional control transfer.
❏ These are return ( ), goto, break and continue.
❏ Of these, return( ) is used only in functions.
❏ The goto and return ( ) may be used anywhere in the program .
❏ Continue and Break statements may be used only in conjunction with a loop
statement.
❏ In ‘switch case’ and ‘break’ is used most frequently.
11
13. ❏ goto statement
❏ This statement does not require any condition. This statement passes control
anywhere in the program without least care for any condition.
❏ Syntax :
goto label;
__
__
__
label:
❏ label is any valid label
either before or after
goto.
❏ The label must start
with any character
and can be
constructed with rules
used for forming
identifiers
12
15. ❏ Break statement
❏ The break statement allows the programmer to terminate the loop .
❏ The break skips from the loop or the block in which it is defined.. The control
then automatically passes on to the first statement after the loop or the block.
❏ The break statement can be associated with all the conditional statements
(especially switch( ) case.
❏ the break statement ends execution of the nearest enclosing do, for, or while
statement.
❏ We can also use break statements in the nested loops.
❏ The widest use of this statement is in switch case where it is used to avoid flow
of control from one case to other.
14
16. ❏ Loops in c++
❏ Loops : :- repetition of instructions is called loop there are following loop in
c/c++ language .
15
17. ❏ contd..
❏ A sequence of statement is executed until a specified condition is true. This
sequence of statement to be executed is kept inside the curly braces { }
known as loop body.
❏ After every execution of loop body, condition is checked, and if it is found to
be true the loop body is executed again. When condition check comes out
to be false, the loop body will not be executed.
❏ There are three types of loops:
❏ for loop
❏ while loop
❏ do..while loop
16
18. ❏ Loops in c++
❏ The for statement is equivalent to the while and do-while statements.
❏ The only difference between for and while is that the latter checks the logical
condition and then executes the body of the loop, whereas the for statement
test is always performed at the beginning of the loop.
❏ The body of the loop may not be executed at all times if the condition fails at the
beginning.
❏ The do while loop executes the body of the loop at least once regardless of the
logical condition
17
19. ❏ for loop
❏ for loop is used to execute a set of statement repeatedly until a particular
condition is satisfied. we can say it an open ended loop.
❏ Syntax:
for(initialization; condition ;increment/decrement)
{
statement-block;
}
❏ In for loop we have exactly two semicolons, one after
initialization and second after condition.
❏ In this loop we can have more than one initialization
or increment/decrement, separated using comma
operator.
❏ for loop can have only one condition.
18
21. ❏ Example
❏ #include <iostream>
using namespace std;
int main()
{
int i, n, factorial = 1;
cout<<"Enter a positive integer: ";
cin>>n;
for (i = 1; i <= n; ++i)
{
factorial *= i; // factorial = factorial * i;
}
cout<< "Factorial of "<<n<<" = "<<factorial;
return 0;
}
20
22. ❏ While loop
❏ while loop can be address as an entry control loop. It is completed in 3
steps.
❏ Variable initialization.( e.g int x=0; )
❏ condition( e.g while( x<=10) )
❏ Variable increment or decrement ( x++ or x-- or x=x+2)
❏ Syntax:
variable initialization ; while (condition)
{
statements ;
variable increment or decrement ;
} 21
24. ❏ do...while loop
❏ In some situations it is necessary to execute body of the loop before testing
the condition.
❏ This is also called as post test loop
❏ Such situations can be handled with the help of do-while loop. do statement
evaluates the body of the loop first and at the end, the condition is checked
using while statement.
❏ The do..while loop is an exit condition loop.
23
25. ❏ Syntax and flowchart for do...while loop
❏ Syntax :
do
{
. statement is;
}
while(condition)
24