SlideShare a Scribd company logo
1 of 31
 Switch statement Logical Statement Assignment Statement  Computer programming C++
Instructor                                  Sir AamirJamshid
Crew Members AzeemMumtaz SaqibMunawar Hafiz Ashfaq M.ZeeshanArshad
Logical Statements AND operator It is used to evaluate two conditions . It produces true result if both conditions are true It produces false if any one condition is false Symbol:                                  “&&”
Working
Example
Output Enter the first number 1 Enter the second number 0 0
OR operator It is used to evaluate two conditions It produces true if either condition is true  It produces false result if both conditions are false Symbol:                             “| |”
Working
Example
Output  Enter the first number 1 Enter the second number 0 1
Not Operator It is the reverses the result of condition It gives True if condition is false It gives false  if condition is true Symbol:                                 “!”
Example  ≡  File  Edit  Search  Run  Compile  Debug  Project  Options    Window  Help ╔═[■]════════════════════════════ NONAME00.CPP ══════════════════════════1═[↑]═╗ ║#include<iostream.h>                                                          ▲ ║#include<conio.h>                                                             ■ ║void main()                                                                   ▒ ║{                                                                             ▒ ║clrscr();                                                                     ▒ ║int a;                                                                        ▒ ║cout<<"Enter the number"<<endl;                                               ▒ ║cin>>a;                                                                       ▒ ║if(a%2!=0)                                                                    ▒ ║cout<<"the number is odd";                                                    ▒ ║else                                                                          ▒ ║cout<<"the number is even";                                                   ▒ ║getch();                                                                      ▒ ║}                                                                             ▼ ╚═☼════ 14:3 ═════◄■▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒►─┘ ┌────────────────────────────────── Message ─────────────────────────────2─────┐ │•Compiling NONAME00.CPP:                                                      │ │ Linking TCDEF.EXE:                                                           │ │                                                                              │ │                                                                              │ │                                                                              │ └──────────────────────────────────────────────────────────────────────────────┘  F1 Help  Alt-F8 Next Msg  Alt-F7 PrevMsg  Alt-F9 Compile  F9 Make  F10 Menu
Output Enter the number 8 The number is even
Hafiz Ashfaq
Assignment Statement  A statement that assigns a value to a variable is known as assignment statement. The assignment =is used in assignment statement to assign a value or computational result to a variable. The name of variable is written on the left side of assignment operator and the value is written on the right side. The value can be a constant ,variable ,expression or a function.
Syntax	 Variable=Expression Examples A=100; C=a+b; X=c-d+10;
LVALUE & RVALUE An L value is an operand that can be written on the left side of assignment operator=it must always be a single value. An rvalue is an operand that can be written on the right side of assignment statement=. All Lvaues can be used as Rvalues.
Example  ≡  File  Edit  Search  Run  Compile  Debug  Project  Options    Window  Help ╔═[■]════════════════════════════ NONAME00.CPP ══════════════════════════1═[↑]═╗ ║#include<iostream.h>                                                          ▲ ║#include<conio.h>                                                             ■ ║void main()                                                                   ▒ ║{clrscr();                                                                    ▒ ║inta,b;                                                                      ▒ ║a=10;                                                                         ▒ ║b=5;                                                                          ▒ ║cout<<"a+b="<<a+b<<endl;                                                      ▒ ║cout<<"a-b="<<a-b<<endl;                                                      ▒ ║cout<<"a*b="<<a*b<<endl;                                                      ▒ ║cout<<"a/b="<<a/b<<endl;                                                      ▒ ║cout<<"a%b="<<a%b<<endl;                                                      ▒ ║getch();                                                                      ▒ ║}                                                                             ▼ ╚═☼════ 14:2 ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒►─┘ ┌────────────────────────────────── Message ─────────────────────────────2─────┐ │•Compiling NONAME00.CPP:                                                      │ │ Linking NONAME00.EXE:                                                        │ │                                                                              │ │                                                                              │ │                                                                              │ └──────────────────────────────────────────────────────────────────────────────┘  F1 Help  Alt-F8 Next Msg  Alt-F7 PrevMsg  Alt-F9 Compile  F9 Make  F10 Menu
M.ZeeshanArshad
Example
Output a+b=15 a-b=5 a*b=50 a/b=2 a%b=0
Compound Statement Operator It combines the assignment statement with arithmetic operator Syntax:Variable op= expression Variable: The variable to assign a value Op: Any arithmetic operator Expression:  It can be a constant, variable or arithmetic operation Example: N+=10 ~ N=N+10
Saqibmunawar
Switch Statement It is a conditional structure It is an alternative of “nested if” It is used when there are many choices are available and we need one to be executed
Syntax
Example
Nested Switch
C++,logical statements and assighnment statement

More Related Content

Viewers also liked

c++ programming Unit 3 variables,data types
c++ programming Unit 3 variables,data typesc++ programming Unit 3 variables,data types
c++ programming Unit 3 variables,data typesAAKASH KUMAR
 
Principles of programming languages. Detail notes
Principles of programming languages. Detail notesPrinciples of programming languages. Detail notes
Principles of programming languages. Detail notesVIKAS SINGH BHADOURIA
 
Concept Of C++ Data Types
Concept Of C++ Data TypesConcept Of C++ Data Types
Concept Of C++ Data Typesk v
 

Viewers also liked (6)

c++ programming Unit 3 variables,data types
c++ programming Unit 3 variables,data typesc++ programming Unit 3 variables,data types
c++ programming Unit 3 variables,data types
 
Data types
Data typesData types
Data types
 
Data types
Data typesData types
Data types
 
Principles of programming languages. Detail notes
Principles of programming languages. Detail notesPrinciples of programming languages. Detail notes
Principles of programming languages. Detail notes
 
Concept Of C++ Data Types
Concept Of C++ Data TypesConcept Of C++ Data Types
Concept Of C++ Data Types
 
Data types
Data typesData types
Data types
 

Recently uploaded

Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...PsychoTech Services
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 

Recently uploaded (20)

Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 

C++,logical statements and assighnment statement

  • 1.
  • 2.
  • 3. Switch statement Logical Statement Assignment Statement Computer programming C++
  • 4. Instructor Sir AamirJamshid
  • 5. Crew Members AzeemMumtaz SaqibMunawar Hafiz Ashfaq M.ZeeshanArshad
  • 6. Logical Statements AND operator It is used to evaluate two conditions . It produces true result if both conditions are true It produces false if any one condition is false Symbol: “&&”
  • 9. Output Enter the first number 1 Enter the second number 0 0
  • 10. OR operator It is used to evaluate two conditions It produces true if either condition is true It produces false result if both conditions are false Symbol: “| |”
  • 13. Output Enter the first number 1 Enter the second number 0 1
  • 14. Not Operator It is the reverses the result of condition It gives True if condition is false It gives false if condition is true Symbol: “!”
  • 15. Example ≡ File Edit Search Run Compile Debug Project Options Window Help ╔═[■]════════════════════════════ NONAME00.CPP ══════════════════════════1═[↑]═╗ ║#include<iostream.h> ▲ ║#include<conio.h> ■ ║void main() ▒ ║{ ▒ ║clrscr(); ▒ ║int a; ▒ ║cout<<"Enter the number"<<endl; ▒ ║cin>>a; ▒ ║if(a%2!=0) ▒ ║cout<<"the number is odd"; ▒ ║else ▒ ║cout<<"the number is even"; ▒ ║getch(); ▒ ║} ▼ ╚═☼════ 14:3 ═════◄■▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒►─┘ ┌────────────────────────────────── Message ─────────────────────────────2─────┐ │•Compiling NONAME00.CPP: │ │ Linking TCDEF.EXE: │ │ │ │ │ │ │ └──────────────────────────────────────────────────────────────────────────────┘ F1 Help Alt-F8 Next Msg Alt-F7 PrevMsg Alt-F9 Compile F9 Make F10 Menu
  • 16. Output Enter the number 8 The number is even
  • 18. Assignment Statement A statement that assigns a value to a variable is known as assignment statement. The assignment =is used in assignment statement to assign a value or computational result to a variable. The name of variable is written on the left side of assignment operator and the value is written on the right side. The value can be a constant ,variable ,expression or a function.
  • 19. Syntax Variable=Expression Examples A=100; C=a+b; X=c-d+10;
  • 20. LVALUE & RVALUE An L value is an operand that can be written on the left side of assignment operator=it must always be a single value. An rvalue is an operand that can be written on the right side of assignment statement=. All Lvaues can be used as Rvalues.
  • 21. Example ≡ File Edit Search Run Compile Debug Project Options Window Help ╔═[■]════════════════════════════ NONAME00.CPP ══════════════════════════1═[↑]═╗ ║#include<iostream.h> ▲ ║#include<conio.h> ■ ║void main() ▒ ║{clrscr(); ▒ ║inta,b; ▒ ║a=10; ▒ ║b=5; ▒ ║cout<<"a+b="<<a+b<<endl; ▒ ║cout<<"a-b="<<a-b<<endl; ▒ ║cout<<"a*b="<<a*b<<endl; ▒ ║cout<<"a/b="<<a/b<<endl; ▒ ║cout<<"a%b="<<a%b<<endl; ▒ ║getch(); ▒ ║} ▼ ╚═☼════ 14:2 ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒►─┘ ┌────────────────────────────────── Message ─────────────────────────────2─────┐ │•Compiling NONAME00.CPP: │ │ Linking NONAME00.EXE: │ │ │ │ │ │ │ └──────────────────────────────────────────────────────────────────────────────┘ F1 Help Alt-F8 Next Msg Alt-F7 PrevMsg Alt-F9 Compile F9 Make F10 Menu
  • 24. Output a+b=15 a-b=5 a*b=50 a/b=2 a%b=0
  • 25. Compound Statement Operator It combines the assignment statement with arithmetic operator Syntax:Variable op= expression Variable: The variable to assign a value Op: Any arithmetic operator Expression: It can be a constant, variable or arithmetic operation Example: N+=10 ~ N=N+10
  • 27. Switch Statement It is a conditional structure It is an alternative of “nested if” It is used when there are many choices are available and we need one to be executed