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 (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

MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
Krashi Coaching
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
中 央社
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
CaitlinCummins3
 

Recently uploaded (20)

MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
 
Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment
 Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment
Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment
 
MOOD STABLIZERS DRUGS.pptx
MOOD     STABLIZERS           DRUGS.pptxMOOD     STABLIZERS           DRUGS.pptx
MOOD STABLIZERS DRUGS.pptx
 
The Last Leaf, a short story by O. Henry
The Last Leaf, a short story by O. HenryThe Last Leaf, a short story by O. Henry
The Last Leaf, a short story by O. Henry
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT VẬT LÝ 2024 - TỪ CÁC TRƯỜNG, TRƯ...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT VẬT LÝ 2024 - TỪ CÁC TRƯỜNG, TRƯ...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT VẬT LÝ 2024 - TỪ CÁC TRƯỜNG, TRƯ...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT VẬT LÝ 2024 - TỪ CÁC TRƯỜNG, TRƯ...
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in Hinduism
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptx
 
Operations Management - Book1.p - Dr. Abdulfatah A. Salem
Operations Management - Book1.p  - Dr. Abdulfatah A. SalemOperations Management - Book1.p  - Dr. Abdulfatah A. Salem
Operations Management - Book1.p - Dr. Abdulfatah A. Salem
 
Graduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxGraduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptx
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
Incoming and Outgoing Shipments in 2 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 2 STEPS Using Odoo 17Incoming and Outgoing Shipments in 2 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 2 STEPS Using Odoo 17
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
 
IPL Online Quiz by Pragya; Question Set.
IPL Online Quiz by Pragya; Question Set.IPL Online Quiz by Pragya; Question Set.
IPL Online Quiz by Pragya; Question Set.
 
MichaelStarkes_UncutGemsProjectSummary.pdf
MichaelStarkes_UncutGemsProjectSummary.pdfMichaelStarkes_UncutGemsProjectSummary.pdf
MichaelStarkes_UncutGemsProjectSummary.pdf
 
size separation d pharm 1st year pharmaceutics
size separation d pharm 1st year pharmaceuticssize separation d pharm 1st year pharmaceutics
size separation d pharm 1st year pharmaceutics
 
Championnat de France de Tennis de table/
Championnat de France de Tennis de table/Championnat de France de Tennis de table/
Championnat de France de Tennis de table/
 
ANTI PARKISON DRUGS.pptx
ANTI         PARKISON          DRUGS.pptxANTI         PARKISON          DRUGS.pptx
ANTI PARKISON DRUGS.pptx
 
An Overview of the Odoo 17 Discuss App.pptx
An Overview of the Odoo 17 Discuss App.pptxAn Overview of the Odoo 17 Discuss App.pptx
An Overview of the Odoo 17 Discuss App.pptx
 

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