SlideShare a Scribd company logo
Lab 4
CS106 - Fundamentals of Computer Science
Presented by TA. Nada Kamel
Agenda
 ASCII Table
 Relational Operators
 Logical Operators
 If/else condition
 Multiway if/else condition
 Example
 Hands-on problems
Presented by TA. Nada Kamel
ASCII Table
Presented by TA. Nada Kamel
ASCII Table
Presented by TA. Nada Kamel
Relational Operators
Presented by TA. Nada Kamel
Relational Operators
Relational Operator Description
== Equal to
!= Not equal to
< Less than
> Greater than
<= Less than or equal to
>= Greater than or equal to
Presented by TA. Nada Kamel
Logical Operators
Presented by TA. Nada Kamel
Logical Operators
Logical Operator Description
! not
&& and
|| or
Presented by TA. Nada Kamel
If/else
Presented by TA. Nada Kamel
if/else flowchart
Presented by TA. Nada Kamel
If/else
if(boolean_expression)
{
// statement(s) will execute if the boolean expression is true
}
else
{
// statement(s) will execute if the boolean expression is false
}
Presented by TA. Nada Kamel
Boolean Expressions
 if (a == 5)
an expression to check if the value of a is equal to 5
 if (a*b >= c)
an expression to check if the value of a multiply by b is greater than or equal to
the value of c
 if (my_char == ’s’)
an expression to check if the value of my_char is equal to ‘s’
 if (a == 8 && b == 3)
an expression to check if the value of a is equal to 8 and the value of
b is equal to 3
Presented by TA. Nada Kamel
Multiway if/else
Presented by TA. Nada Kamel
Multiway if/else
if(boolean_expression_1)
{
// statements to be executed if the first boolean expression is true
}
else if(boolean_expression_2)
{
// statements to be executed if the first boolean expression is false and the
second boolean expression is true
}
..
..
else
{
// statements to be executed if all test expressions are false
}
Presented by TA. Nada Kamel
Example
Presented by TA. Nada Kamel
Example
Write a program in C++ that reads three scores of a student in
three tests to compute and display the largest score.
Presented by TA. Nada Kamel
Hands-on Problem
Presented by TA. Nada Kamel
Problem 1
Write a program in C++ that reads a positive integer number to
notify the user with a message whether the integer number Even
or Odd.
Presented by TA. Nada Kamel
Problem 2
 Community Hospital needs a program to compute and print a statement for each
patient.
 Charges for each day are as follows:
a) Room charges: private room, $125.00; semiprivate room, $95.00; or ward, $75.00
b) Telephone charge: $1.75
c) Television charge: $3.50
 Write a program to get one string of four characters from the keyboard, the first
character is an integer value indicating the number of days spent in the hospital,
and the others are three alphabet characters.
 Typical input is: 5PNY
where 5 indicates the number of days spent in the hospital, P represents the room
type (P, S, or W), N represents the telephone option (Y or N), and Y represents the
television option (Y or N).
Presented by TA. Nada Kamel
Any Questions?
Presented by TA. Nada Kamel

More Related Content

What's hot

Java -lec-5
Java -lec-5Java -lec-5
Java -lec-5
Zubair Khalid
 
Why you should use a testing framework
Why you should use a testing frameworkWhy you should use a testing framework
Why you should use a testing framework
Richie Cotton
 
Code Tuning
Code TuningCode Tuning
Code Tuning
bgtraghu
 
Arrays c4 c5
Arrays c4 c5Arrays c4 c5
Arrays c4 c5
Omar Al-Sabek
 
Johnson Trotter Algorithm(Permutation)
Johnson Trotter Algorithm(Permutation)Johnson Trotter Algorithm(Permutation)
Johnson Trotter Algorithm(Permutation)
International Islamic University
 
Data structures and algorithms lab2
Data structures and algorithms lab2Data structures and algorithms lab2
Data structures and algorithms lab2Bianca Teşilă
 
Function procedure c6 c7
Function procedure  c6 c7Function procedure  c6 c7
Function procedure c6 c7
Omar Al-Sabek
 
Evaluation of prefix expression with example
Evaluation of prefix expression with exampleEvaluation of prefix expression with example
Evaluation of prefix expression with example
GADAPURAMSAINIKHIL
 
Data structures and algorithms lab3
Data structures and algorithms lab3Data structures and algorithms lab3
Data structures and algorithms lab3Bianca Teşilă
 
Lecture4
Lecture4Lecture4
Lecture4
Rudy Martinez
 
Hw5 2017-spring
Hw5 2017-springHw5 2017-spring
Hw5 2017-spring
奕安 陳
 
Functional programming
Functional programmingFunctional programming
Functional programming
Olivier Teytaud
 
Lecture05 abap on line
Lecture05 abap on lineLecture05 abap on line
Lecture05 abap on lineMilind Patil
 
Effective java item 80 and 81
Effective java   item 80 and 81Effective java   item 80 and 81
Effective java item 80 and 81
Isaac Liao
 
09 advanced c#
09 advanced c#09 advanced c#
09 advanced c#eleksdev
 
Insertion sort
Insertion sort Insertion sort
Insertion sort
Monalisa Patel
 

What's hot (18)

Java -lec-5
Java -lec-5Java -lec-5
Java -lec-5
 
Daa
DaaDaa
Daa
 
Why you should use a testing framework
Why you should use a testing frameworkWhy you should use a testing framework
Why you should use a testing framework
 
Code Tuning
Code TuningCode Tuning
Code Tuning
 
Arrays c4 c5
Arrays c4 c5Arrays c4 c5
Arrays c4 c5
 
Johnson Trotter Algorithm(Permutation)
Johnson Trotter Algorithm(Permutation)Johnson Trotter Algorithm(Permutation)
Johnson Trotter Algorithm(Permutation)
 
Data structures and algorithms lab2
Data structures and algorithms lab2Data structures and algorithms lab2
Data structures and algorithms lab2
 
Function procedure c6 c7
Function procedure  c6 c7Function procedure  c6 c7
Function procedure c6 c7
 
Evaluation of prefix expression with example
Evaluation of prefix expression with exampleEvaluation of prefix expression with example
Evaluation of prefix expression with example
 
Data structures and algorithms lab3
Data structures and algorithms lab3Data structures and algorithms lab3
Data structures and algorithms lab3
 
Lecture4
Lecture4Lecture4
Lecture4
 
Hw5 2017-spring
Hw5 2017-springHw5 2017-spring
Hw5 2017-spring
 
Functional programming
Functional programmingFunctional programming
Functional programming
 
Lecture05 abap on line
Lecture05 abap on lineLecture05 abap on line
Lecture05 abap on line
 
Effective java item 80 and 81
Effective java   item 80 and 81Effective java   item 80 and 81
Effective java item 80 and 81
 
Overriding methods
Overriding methodsOverriding methods
Overriding methods
 
09 advanced c#
09 advanced c#09 advanced c#
09 advanced c#
 
Insertion sort
Insertion sort Insertion sort
Insertion sort
 

Similar to CS106 Lab 4 - If statement

06
0606
1 Computer Assignment 3 --- Hypothesis tests about m.docx
1 Computer Assignment 3     ---   Hypothesis tests about m.docx1 Computer Assignment 3     ---   Hypothesis tests about m.docx
1 Computer Assignment 3 --- Hypothesis tests about m.docx
mercysuttle
 
Orthogonal array testing
Orthogonal array testingOrthogonal array testing
Orthogonal array testingPrince Bhanwra
 
Conditional Statements
Conditional StatementsConditional Statements
Conditional Statements
MuhammadBakri13
 
Csci101 lect07 algorithms_ii
Csci101 lect07 algorithms_iiCsci101 lect07 algorithms_ii
Csci101 lect07 algorithms_ii
Elsayed Hemayed
 
· Assignment 1. Linear Programming Case StudyYour instruct.docx
· Assignment 1. Linear Programming Case StudyYour instruct.docx· Assignment 1. Linear Programming Case StudyYour instruct.docx
· Assignment 1. Linear Programming Case StudyYour instruct.docx
LynellBull52
 
c++ Data Types and Selection
c++ Data Types and Selectionc++ Data Types and Selection
c++ Data Types and Selection
Ahmed Nobi
 
05. Conditional Statements
05. Conditional Statements05. Conditional Statements
05. Conditional Statements
Intro C# Book
 
Lec16.pptx problem specifications computer
Lec16.pptx problem specifications computerLec16.pptx problem specifications computer
Lec16.pptx problem specifications computer
samiullahamjad06
 
C programming assignment presentation file
C programming assignment presentation fileC programming assignment presentation file
C programming assignment presentation file
santoshkumarhpu
 
D-Pubb-TestingExperience_Issue_28_2014-12_Berta
D-Pubb-TestingExperience_Issue_28_2014-12_BertaD-Pubb-TestingExperience_Issue_28_2014-12_Berta
D-Pubb-TestingExperience_Issue_28_2014-12_BertaBerta Danilo
 
Module code 124ms Tajvinder Virdee Sets and Log.docx
Module code 124ms  Tajvinder Virdee  Sets and Log.docxModule code 124ms  Tajvinder Virdee  Sets and Log.docx
Module code 124ms Tajvinder Virdee Sets and Log.docx
moirarandell
 
Testing lab manual Testing lab manual sqa
Testing lab manual Testing lab manual sqaTesting lab manual Testing lab manual sqa
Testing lab manual Testing lab manual sqa
MuhammadAdnan845624
 
OverviewThis hands-on lab allows you to follow and experiment w.docx
OverviewThis hands-on lab allows you to follow and experiment w.docxOverviewThis hands-on lab allows you to follow and experiment w.docx
OverviewThis hands-on lab allows you to follow and experiment w.docx
gerardkortney
 
Lab5
Lab5Lab5
Advanced VB: Review of the basics
Advanced VB: Review of the basicsAdvanced VB: Review of the basics
Advanced VB: Review of the basicsrobertbenard
 
Advanced VB: Review of the basics
Advanced VB: Review of the basicsAdvanced VB: Review of the basics
Advanced VB: Review of the basicsrobertbenard
 
03. Week 03.pptx
03. Week 03.pptx03. Week 03.pptx
03. Week 03.pptx
Vinc2ntCabrera
 

Similar to CS106 Lab 4 - If statement (20)

06
0606
06
 
1 Computer Assignment 3 --- Hypothesis tests about m.docx
1 Computer Assignment 3     ---   Hypothesis tests about m.docx1 Computer Assignment 3     ---   Hypothesis tests about m.docx
1 Computer Assignment 3 --- Hypothesis tests about m.docx
 
Orthogonal array testing
Orthogonal array testingOrthogonal array testing
Orthogonal array testing
 
Conditional Statements
Conditional StatementsConditional Statements
Conditional Statements
 
Csci101 lect07 algorithms_ii
Csci101 lect07 algorithms_iiCsci101 lect07 algorithms_ii
Csci101 lect07 algorithms_ii
 
· Assignment 1. Linear Programming Case StudyYour instruct.docx
· Assignment 1. Linear Programming Case StudyYour instruct.docx· Assignment 1. Linear Programming Case StudyYour instruct.docx
· Assignment 1. Linear Programming Case StudyYour instruct.docx
 
c++ Data Types and Selection
c++ Data Types and Selectionc++ Data Types and Selection
c++ Data Types and Selection
 
Perl_Part2
Perl_Part2Perl_Part2
Perl_Part2
 
05. Conditional Statements
05. Conditional Statements05. Conditional Statements
05. Conditional Statements
 
MA3696 Lecture 7
MA3696 Lecture 7MA3696 Lecture 7
MA3696 Lecture 7
 
Lec16.pptx problem specifications computer
Lec16.pptx problem specifications computerLec16.pptx problem specifications computer
Lec16.pptx problem specifications computer
 
C programming assignment presentation file
C programming assignment presentation fileC programming assignment presentation file
C programming assignment presentation file
 
D-Pubb-TestingExperience_Issue_28_2014-12_Berta
D-Pubb-TestingExperience_Issue_28_2014-12_BertaD-Pubb-TestingExperience_Issue_28_2014-12_Berta
D-Pubb-TestingExperience_Issue_28_2014-12_Berta
 
Module code 124ms Tajvinder Virdee Sets and Log.docx
Module code 124ms  Tajvinder Virdee  Sets and Log.docxModule code 124ms  Tajvinder Virdee  Sets and Log.docx
Module code 124ms Tajvinder Virdee Sets and Log.docx
 
Testing lab manual Testing lab manual sqa
Testing lab manual Testing lab manual sqaTesting lab manual Testing lab manual sqa
Testing lab manual Testing lab manual sqa
 
OverviewThis hands-on lab allows you to follow and experiment w.docx
OverviewThis hands-on lab allows you to follow and experiment w.docxOverviewThis hands-on lab allows you to follow and experiment w.docx
OverviewThis hands-on lab allows you to follow and experiment w.docx
 
Lab5
Lab5Lab5
Lab5
 
Advanced VB: Review of the basics
Advanced VB: Review of the basicsAdvanced VB: Review of the basics
Advanced VB: Review of the basics
 
Advanced VB: Review of the basics
Advanced VB: Review of the basicsAdvanced VB: Review of the basics
Advanced VB: Review of the basics
 
03. Week 03.pptx
03. Week 03.pptx03. Week 03.pptx
03. Week 03.pptx
 

Recently uploaded

Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
chanes7
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
Normal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of LabourNormal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of Labour
Wasim Ak
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Multithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race conditionMultithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race condition
Mohammed Sikander
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 

Recently uploaded (20)

Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Normal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of LabourNormal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of Labour
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Multithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race conditionMultithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race condition
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 

CS106 Lab 4 - If statement

  • 1. Lab 4 CS106 - Fundamentals of Computer Science Presented by TA. Nada Kamel
  • 2. Agenda  ASCII Table  Relational Operators  Logical Operators  If/else condition  Multiway if/else condition  Example  Hands-on problems Presented by TA. Nada Kamel
  • 3. ASCII Table Presented by TA. Nada Kamel
  • 4. ASCII Table Presented by TA. Nada Kamel
  • 6. Relational Operators Relational Operator Description == Equal to != Not equal to < Less than > Greater than <= Less than or equal to >= Greater than or equal to Presented by TA. Nada Kamel
  • 8. Logical Operators Logical Operator Description ! not && and || or Presented by TA. Nada Kamel
  • 11. If/else if(boolean_expression) { // statement(s) will execute if the boolean expression is true } else { // statement(s) will execute if the boolean expression is false } Presented by TA. Nada Kamel
  • 12. Boolean Expressions  if (a == 5) an expression to check if the value of a is equal to 5  if (a*b >= c) an expression to check if the value of a multiply by b is greater than or equal to the value of c  if (my_char == ’s’) an expression to check if the value of my_char is equal to ‘s’  if (a == 8 && b == 3) an expression to check if the value of a is equal to 8 and the value of b is equal to 3 Presented by TA. Nada Kamel
  • 14. Multiway if/else if(boolean_expression_1) { // statements to be executed if the first boolean expression is true } else if(boolean_expression_2) { // statements to be executed if the first boolean expression is false and the second boolean expression is true } .. .. else { // statements to be executed if all test expressions are false } Presented by TA. Nada Kamel
  • 16. Example Write a program in C++ that reads three scores of a student in three tests to compute and display the largest score. Presented by TA. Nada Kamel
  • 17.
  • 19. Problem 1 Write a program in C++ that reads a positive integer number to notify the user with a message whether the integer number Even or Odd. Presented by TA. Nada Kamel
  • 20.
  • 21. Problem 2  Community Hospital needs a program to compute and print a statement for each patient.  Charges for each day are as follows: a) Room charges: private room, $125.00; semiprivate room, $95.00; or ward, $75.00 b) Telephone charge: $1.75 c) Television charge: $3.50  Write a program to get one string of four characters from the keyboard, the first character is an integer value indicating the number of days spent in the hospital, and the others are three alphabet characters.  Typical input is: 5PNY where 5 indicates the number of days spent in the hospital, P represents the room type (P, S, or W), N represents the telephone option (Y or N), and Y represents the television option (Y or N). Presented by TA. Nada Kamel
  • 22.
  • 23. Any Questions? Presented by TA. Nada Kamel