SlideShare a Scribd company logo
PROGRAMMING
Presentation By :-
Farooq Mian
Mubashir Hussain
Ishfaq Ahmad
To :- Sir Abdul Quddus Bajwa
Farooq
Topics :-
• 1- Break
• 2- Continue
• 3- Switch
• 4- Nested if Else
Break Statement:-
The break
statement is used in the body
of the loop to exit from the
loop. When this statement is
executed in the loop body, the
remaining iterations of the loop
are skipped. The control
directly moves outside the body
and the statement that comes
after the body is executed.
Example:-
for(int a=1; a<=5; a++)
{
cout<<“farooq”<<endl;
break;
cout<<“Computer“<<endl;
}
cout<<“break statement”;
Continue Statement:-
The continue
statement is used in the body
of the loop. It is used to move
the control to start of the loop
body. When this statement is
executed in the loop body, the
remaining statements of
current iteration are not
executed. The control directly
moves to the next iteration.
Example:-
for(int b=1; b<=5; b++)
{
cout<<“farooq”<<endl;
continue;
cout<<“Computer“<<endl;
}
Nested If:-
An if statement
within an if statement is
called nested if statement.
In nested structure, the
control enters into the
inner if only when the
outer condition is true.
Only one block of
statements are executed
and the remaining blocks
are skipped automatically.
Syntax:-
If (condition)
if (condition)
{ Inner if
statement(s);
} Outer if
else
{
statement(s);
}
else
{
statement(s);
}
Example:-
#include<constream.h>
void main () {
int a,b,c;
clrscr();
cout<<“Enter three numbers: “;
cin>>a>>b>>c;
if(a<b)
if (a<c) Outer if
cout<<a<<“ is smallest number.”;
else Inner if
cout<<c<<“ is smallest number.”;
if (b<c)
cout<<b<<“ is smallest number.”;
else
cout<<c<<“is smallest number.”;
getch();
}
Switch Statement:-
The switch
statement is another
conditional structure. It is a
good alternative of nested if
else. It can be used easily when
there are many choices
available and only one should
be executed. Nested if becomes
very difficult in such situation.
Syntax:-
switch (expression)
{
case constant 1:
statement(s);
break;
case constant 2:
statement(s);
break;
.
.
.
case constant n:
statement(s);
break;
default:
statement(s);
}
Example:-
#include<constream.h>
void main()
{
clrscr();
cout<<endl<<"Grafika Printers"<<endl;
int a;
cout<<endl<<" Enter I.D:- ";
cin>>a;
switch(a)
{
case 113323:
cout<<endl<<" Name:- Farooq Tasneem Mian";
break;
case 113324:
cout<<endl<<" Name:- Ahmed Tasneem Mian";
break;
case 113325:
cout<<endl<<" Name:- Muhammad Tasneem Mian";
break;
default:
cout<<endl<<" Invaid I.D"<<endl;
}
getch();
}
Mubashir
Topics :-
• 1- Goto
• 2- Loops
• 3- Return
Goto Statement:-
The ‘goto’
statement is used to move the
control directly to a particular
location of the program by
using label. A label is a name
given to a particular line of the
program. A label is created with
a vaild identifier followed by a
colon (:)
Syntax:-
goto Label;
The ‘Label’ indicates the lable to which
the control is transferred.
Example:-
#include<constream.h>
void main () {
int n=1;
loop:
cout<<n<<“ C++”<<endl;
n++;
if (n<=5) goto loop;
getch();
}
Loops:-
A type of control
structure that repeats a
statement or set of statements
is known as looping structure.
Types of Loops :-
1. While loop
2. Do-while loop
3. For loop
While loop:-
while loop is the
simplest loop of C++ language.
This loop exectues one or more
statements while the given
condition remains true. It is
useful when the number of
iterations is not known in
advance.
Syntax:-
while (condition)
statement;
Example:-
#include<constream.h>
void main () {
int a=1;
while (a<=5) {
cout<<“C++”<<endl;
a++;
}
getch();
}
Do-While loop:-
do-while is an
iterative control in c++
language. This loop executes
one or more statements while
the given condition is true. In
this loop, the condition comes
after the body of the loop. It is
an important loop in a situation
when the loop body must be
executed at least once.
Syntax:-
do
{ statement 1;
statement 2;
} while (condition);
Example:-
#include<constream.h>
void main () {
int a=10;
do {
cout<<a<<endl;
a=a-1; }
while (a>=10)
getch();
}
For loop:-
for loop executes
one or more statements for a
specified number of times. This
loop is also called counter-
controlled loop. It is the most
flexible loop. That is why, it is
the most frequently used loop
by the programmers.
Syntax:-
for (initialization;condition;++/--)
Example:-
#include<constream.h>
void main () {
int a;
for(a=1;a<=5;a++)
cout<<a<<endl;
getch();
}
Return Statement:-
if return =0
then it gives successful
termination and if we return
any variable then it gives its
value to specific variable.
Example:-
(int sum (int a, int b))
{
int add;
add=a+b;
return add;
Ishfaq
Topics :-
• 1- Control Structure
• 2- If
• 3- If Else
Control Structure:-
A
statement used to control the
flow of execution in a program
is called control structure. The
instructions in a program can
be organized in three kinds of
control structures to control
execution flow. The control
structures are used to
implement the program logic.
Types of Control Structure:-
1. Selection
2. Sequence
3. Repetition
4. Function Call
If Statement:-
if is a keyword in
C++ language. If statement is a
decision-making statement. It is
the simplest form of selection
constructs. It is used to execute
or skip a statement or a set of
statements by checking a
condition.
Syntax:-
if (condition)
statement;
Example:-
#include<constream.h>
void main () {
int marks;
cout<<“Enter your marks”;
cin>>marks;
if (marks>=40)
cout<<“You passed”;
getch();
}
If-Else Statement:-
if-else statement is
another type of if statement. It
executes one block of
statement(s) when the
condition is true and the other
when it is false. In any
situation, one block is executed
and the other is skipped. In if-
else statement.
Syntax:-
if (condition)
statement;
else
statement;
Example:-
#include<constream.h>
void main () {
int a;
cout<<“Enter Number”;
cin>>a;
if (a%2==0)
cout<<a<<“is odd”;
else
cout<<a<<“is even”;
getch();
}
THANK
YOU

More Related Content

Viewers also liked

CHAPTER 3
CHAPTER 3CHAPTER 3
CHAPTER 3
mohd_mizan
 
C Language Program
C Language ProgramC Language Program
C Language Program
Warawut
 
8.1 alogorithm & prolem solving
8.1 alogorithm & prolem solving8.1 alogorithm & prolem solving
8.1 alogorithm & prolem solving
Khan Yousafzai
 
Complete C programming Language Course
Complete C programming Language CourseComplete C programming Language Course
Complete C programming Language Course
Vivek chan
 
Introduction to Basic C programming 02
Introduction to Basic C programming 02Introduction to Basic C programming 02
Introduction to Basic C programming 02
Wingston
 
Structure in C
Structure in CStructure in C
Structure in C
Kamal Acharya
 
C ppt
C pptC ppt
C ppt
jasmeen kr
 
Introduction to C Programming
Introduction to C ProgrammingIntroduction to C Programming
Lecture18 structurein c.ppt
Lecture18 structurein c.pptLecture18 structurein c.ppt
Lecture18 structurein c.ppt
eShikshak
 

Viewers also liked (9)

CHAPTER 3
CHAPTER 3CHAPTER 3
CHAPTER 3
 
C Language Program
C Language ProgramC Language Program
C Language Program
 
8.1 alogorithm & prolem solving
8.1 alogorithm & prolem solving8.1 alogorithm & prolem solving
8.1 alogorithm & prolem solving
 
Complete C programming Language Course
Complete C programming Language CourseComplete C programming Language Course
Complete C programming Language Course
 
Introduction to Basic C programming 02
Introduction to Basic C programming 02Introduction to Basic C programming 02
Introduction to Basic C programming 02
 
Structure in C
Structure in CStructure in C
Structure in C
 
C ppt
C pptC ppt
C ppt
 
Introduction to C Programming
Introduction to C ProgrammingIntroduction to C Programming
Introduction to C Programming
 
Lecture18 structurein c.ppt
Lecture18 structurein c.pptLecture18 structurein c.ppt
Lecture18 structurein c.ppt
 

Similar to Basic C concepts.

Cs1123 6 loops
Cs1123 6 loopsCs1123 6 loops
Cs1123 6 loops
TAlha MAlik
 
FP 201 - Unit 3 Part 2
FP 201 - Unit 3 Part 2FP 201 - Unit 3 Part 2
FP 201 - Unit 3 Part 2
rohassanie
 
Oop object oriented programing topics
Oop object oriented programing topicsOop object oriented programing topics
Oop object oriented programing topics
(•̮̮̃•̃) Prince Do Not Work
 
Loops
LoopsLoops
Object oriented programming system with C++
Object oriented programming system with C++Object oriented programming system with C++
Object oriented programming system with C++
msharshitha03s
 
Programming Fundamentals in C++ structures
Programming Fundamentals in  C++ structuresProgramming Fundamentals in  C++ structures
Programming Fundamentals in C++ structures
ayshasafdarwaada
 
Loops_and_FunctionsWeek4_0.ppt
Loops_and_FunctionsWeek4_0.pptLoops_and_FunctionsWeek4_0.ppt
Loops_and_FunctionsWeek4_0.ppt
KamranAli649587
 
Iteration
IterationIteration
Iteration
Liam Dunphy
 
Control Statement.ppt
Control Statement.pptControl Statement.ppt
Control Statement.ppt
sanjay
 
C++ lecture 02
C++   lecture 02C++   lecture 02
C++ lecture 02
HNDE Labuduwa Galle
 
03 conditions loops
03   conditions loops03   conditions loops
03 conditions loops
Manzoor ALam
 
C lecture 4 nested loops and jumping statements slideshare
C lecture 4 nested loops and jumping statements slideshareC lecture 4 nested loops and jumping statements slideshare
C lecture 4 nested loops and jumping statements slideshare
Gagan Deep
 
Control structures.ppt
Control structures.pptControl structures.ppt
Control structures.ppt
Rahul Borate
 
5.pptx fundamental programing one branch
5.pptx fundamental programing one branch5.pptx fundamental programing one branch
5.pptx fundamental programing one branch
ssuserdde43b
 
Looping Statement And Flow Chart
 Looping Statement And Flow Chart Looping Statement And Flow Chart
Looping Statement And Flow Chart
Rahul Sahu
 
C++ chapter 4
C++ chapter 4C++ chapter 4
C++ chapter 4
SHRIRANG PINJARKAR
 
Loops IN COMPUTER SCIENCE STANDARD 11 BY KR
Loops IN COMPUTER SCIENCE STANDARD 11 BY KRLoops IN COMPUTER SCIENCE STANDARD 11 BY KR
Loops IN COMPUTER SCIENCE STANDARD 11 BY KR
Krishna Raj
 
Decision Making and Looping
Decision Making and LoopingDecision Making and Looping
Decision Making and Looping
Munazza-Mah-Jabeen
 
Flow of control ppt
Flow of control pptFlow of control ppt
Lect3-C--EEB.pptx
Lect3-C--EEB.pptxLect3-C--EEB.pptx
Lect3-C--EEB.pptx
KIJAMALEGI
 

Similar to Basic C concepts. (20)

Cs1123 6 loops
Cs1123 6 loopsCs1123 6 loops
Cs1123 6 loops
 
FP 201 - Unit 3 Part 2
FP 201 - Unit 3 Part 2FP 201 - Unit 3 Part 2
FP 201 - Unit 3 Part 2
 
Oop object oriented programing topics
Oop object oriented programing topicsOop object oriented programing topics
Oop object oriented programing topics
 
Loops
LoopsLoops
Loops
 
Object oriented programming system with C++
Object oriented programming system with C++Object oriented programming system with C++
Object oriented programming system with C++
 
Programming Fundamentals in C++ structures
Programming Fundamentals in  C++ structuresProgramming Fundamentals in  C++ structures
Programming Fundamentals in C++ structures
 
Loops_and_FunctionsWeek4_0.ppt
Loops_and_FunctionsWeek4_0.pptLoops_and_FunctionsWeek4_0.ppt
Loops_and_FunctionsWeek4_0.ppt
 
Iteration
IterationIteration
Iteration
 
Control Statement.ppt
Control Statement.pptControl Statement.ppt
Control Statement.ppt
 
C++ lecture 02
C++   lecture 02C++   lecture 02
C++ lecture 02
 
03 conditions loops
03   conditions loops03   conditions loops
03 conditions loops
 
C lecture 4 nested loops and jumping statements slideshare
C lecture 4 nested loops and jumping statements slideshareC lecture 4 nested loops and jumping statements slideshare
C lecture 4 nested loops and jumping statements slideshare
 
Control structures.ppt
Control structures.pptControl structures.ppt
Control structures.ppt
 
5.pptx fundamental programing one branch
5.pptx fundamental programing one branch5.pptx fundamental programing one branch
5.pptx fundamental programing one branch
 
Looping Statement And Flow Chart
 Looping Statement And Flow Chart Looping Statement And Flow Chart
Looping Statement And Flow Chart
 
C++ chapter 4
C++ chapter 4C++ chapter 4
C++ chapter 4
 
Loops IN COMPUTER SCIENCE STANDARD 11 BY KR
Loops IN COMPUTER SCIENCE STANDARD 11 BY KRLoops IN COMPUTER SCIENCE STANDARD 11 BY KR
Loops IN COMPUTER SCIENCE STANDARD 11 BY KR
 
Decision Making and Looping
Decision Making and LoopingDecision Making and Looping
Decision Making and Looping
 
Flow of control ppt
Flow of control pptFlow of control ppt
Flow of control ppt
 
Lect3-C--EEB.pptx
Lect3-C--EEB.pptxLect3-C--EEB.pptx
Lect3-C--EEB.pptx
 

More from Farooq Mian

DFD
DFDDFD
Scrum Model
Scrum ModelScrum Model
Scrum Model
Farooq Mian
 
Theory of Automata
Theory of AutomataTheory of Automata
Theory of Automata
Farooq Mian
 
Basic Web Page, Twitter, Facebook introduction
Basic Web Page, Twitter, Facebook introduction Basic Web Page, Twitter, Facebook introduction
Basic Web Page, Twitter, Facebook introduction
Farooq Mian
 
Business Report Writing
Business Report WritingBusiness Report Writing
Business Report Writing
Farooq Mian
 
Vehicle Parking System Project
Vehicle Parking System ProjectVehicle Parking System Project
Vehicle Parking System Project
Farooq Mian
 
Database Join
Database JoinDatabase Join
Database Join
Farooq Mian
 
SDLC of Shareef Oxygen Company
SDLC of Shareef Oxygen CompanySDLC of Shareef Oxygen Company
SDLC of Shareef Oxygen Company
Farooq Mian
 
Traffic Problems in Cities.
Traffic Problems in Cities. Traffic Problems in Cities.
Traffic Problems in Cities.
Farooq Mian
 

More from Farooq Mian (9)

DFD
DFDDFD
DFD
 
Scrum Model
Scrum ModelScrum Model
Scrum Model
 
Theory of Automata
Theory of AutomataTheory of Automata
Theory of Automata
 
Basic Web Page, Twitter, Facebook introduction
Basic Web Page, Twitter, Facebook introduction Basic Web Page, Twitter, Facebook introduction
Basic Web Page, Twitter, Facebook introduction
 
Business Report Writing
Business Report WritingBusiness Report Writing
Business Report Writing
 
Vehicle Parking System Project
Vehicle Parking System ProjectVehicle Parking System Project
Vehicle Parking System Project
 
Database Join
Database JoinDatabase Join
Database Join
 
SDLC of Shareef Oxygen Company
SDLC of Shareef Oxygen CompanySDLC of Shareef Oxygen Company
SDLC of Shareef Oxygen Company
 
Traffic Problems in Cities.
Traffic Problems in Cities. Traffic Problems in Cities.
Traffic Problems in Cities.
 

Recently uploaded

E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
Quickdice ERP
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
TheSMSPoint
 
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise EditionWhy Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Envertis Software Solutions
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
Green Software Development
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
Deuglo Infosystem Pvt Ltd
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
Green Software Development
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
Grant Fritchey
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
Łukasz Chruściel
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
ICS
 
SMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API ServiceSMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API Service
Yara Milbes
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Aftab Hussain
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
Shane Coughlan
 
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s EcosystemUI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
Peter Muessig
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
Remote DBA Services
 
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdfRevolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Undress Baby
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
Peter Muessig
 

Recently uploaded (20)

E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
 
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise EditionWhy Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
 
SMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API ServiceSMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API Service
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
 
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s EcosystemUI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
 
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdfRevolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
 

Basic C concepts.

  • 1.
  • 2. PROGRAMMING Presentation By :- Farooq Mian Mubashir Hussain Ishfaq Ahmad To :- Sir Abdul Quddus Bajwa
  • 3. Farooq Topics :- • 1- Break • 2- Continue • 3- Switch • 4- Nested if Else
  • 4. Break Statement:- The break statement is used in the body of the loop to exit from the loop. When this statement is executed in the loop body, the remaining iterations of the loop are skipped. The control directly moves outside the body and the statement that comes after the body is executed. Example:- for(int a=1; a<=5; a++) { cout<<“farooq”<<endl; break; cout<<“Computer“<<endl; } cout<<“break statement”;
  • 5. Continue Statement:- The continue statement is used in the body of the loop. It is used to move the control to start of the loop body. When this statement is executed in the loop body, the remaining statements of current iteration are not executed. The control directly moves to the next iteration. Example:- for(int b=1; b<=5; b++) { cout<<“farooq”<<endl; continue; cout<<“Computer“<<endl; }
  • 6. Nested If:- An if statement within an if statement is called nested if statement. In nested structure, the control enters into the inner if only when the outer condition is true. Only one block of statements are executed and the remaining blocks are skipped automatically. Syntax:- If (condition) if (condition) { Inner if statement(s); } Outer if else { statement(s); } else { statement(s); }
  • 7. Example:- #include<constream.h> void main () { int a,b,c; clrscr(); cout<<“Enter three numbers: “; cin>>a>>b>>c; if(a<b) if (a<c) Outer if cout<<a<<“ is smallest number.”; else Inner if cout<<c<<“ is smallest number.”; if (b<c) cout<<b<<“ is smallest number.”; else cout<<c<<“is smallest number.”; getch(); }
  • 8. Switch Statement:- The switch statement is another conditional structure. It is a good alternative of nested if else. It can be used easily when there are many choices available and only one should be executed. Nested if becomes very difficult in such situation. Syntax:- switch (expression) { case constant 1: statement(s); break; case constant 2: statement(s); break; . . . case constant n: statement(s); break; default: statement(s); }
  • 9. Example:- #include<constream.h> void main() { clrscr(); cout<<endl<<"Grafika Printers"<<endl; int a; cout<<endl<<" Enter I.D:- "; cin>>a; switch(a) { case 113323: cout<<endl<<" Name:- Farooq Tasneem Mian"; break; case 113324: cout<<endl<<" Name:- Ahmed Tasneem Mian"; break; case 113325: cout<<endl<<" Name:- Muhammad Tasneem Mian"; break; default: cout<<endl<<" Invaid I.D"<<endl; } getch(); }
  • 10. Mubashir Topics :- • 1- Goto • 2- Loops • 3- Return
  • 11. Goto Statement:- The ‘goto’ statement is used to move the control directly to a particular location of the program by using label. A label is a name given to a particular line of the program. A label is created with a vaild identifier followed by a colon (:) Syntax:- goto Label; The ‘Label’ indicates the lable to which the control is transferred. Example:- #include<constream.h> void main () { int n=1; loop: cout<<n<<“ C++”<<endl; n++; if (n<=5) goto loop; getch(); }
  • 12. Loops:- A type of control structure that repeats a statement or set of statements is known as looping structure. Types of Loops :- 1. While loop 2. Do-while loop 3. For loop
  • 13. While loop:- while loop is the simplest loop of C++ language. This loop exectues one or more statements while the given condition remains true. It is useful when the number of iterations is not known in advance. Syntax:- while (condition) statement; Example:- #include<constream.h> void main () { int a=1; while (a<=5) { cout<<“C++”<<endl; a++; } getch(); }
  • 14. Do-While loop:- do-while is an iterative control in c++ language. This loop executes one or more statements while the given condition is true. In this loop, the condition comes after the body of the loop. It is an important loop in a situation when the loop body must be executed at least once. Syntax:- do { statement 1; statement 2; } while (condition); Example:- #include<constream.h> void main () { int a=10; do { cout<<a<<endl; a=a-1; } while (a>=10) getch(); }
  • 15. For loop:- for loop executes one or more statements for a specified number of times. This loop is also called counter- controlled loop. It is the most flexible loop. That is why, it is the most frequently used loop by the programmers. Syntax:- for (initialization;condition;++/--) Example:- #include<constream.h> void main () { int a; for(a=1;a<=5;a++) cout<<a<<endl; getch(); }
  • 16. Return Statement:- if return =0 then it gives successful termination and if we return any variable then it gives its value to specific variable. Example:- (int sum (int a, int b)) { int add; add=a+b; return add;
  • 17. Ishfaq Topics :- • 1- Control Structure • 2- If • 3- If Else
  • 18. Control Structure:- A statement used to control the flow of execution in a program is called control structure. The instructions in a program can be organized in three kinds of control structures to control execution flow. The control structures are used to implement the program logic. Types of Control Structure:- 1. Selection 2. Sequence 3. Repetition 4. Function Call
  • 19. If Statement:- if is a keyword in C++ language. If statement is a decision-making statement. It is the simplest form of selection constructs. It is used to execute or skip a statement or a set of statements by checking a condition. Syntax:- if (condition) statement; Example:- #include<constream.h> void main () { int marks; cout<<“Enter your marks”; cin>>marks; if (marks>=40) cout<<“You passed”; getch(); }
  • 20. If-Else Statement:- if-else statement is another type of if statement. It executes one block of statement(s) when the condition is true and the other when it is false. In any situation, one block is executed and the other is skipped. In if- else statement. Syntax:- if (condition) statement; else statement; Example:- #include<constream.h> void main () { int a; cout<<“Enter Number”; cin>>a; if (a%2==0) cout<<a<<“is odd”; else cout<<a<<“is even”; getch(); }