Professional Documents
Culture Documents
Week 9, Z
Week 9, Z
Topic:
we've learnt how to collect basic data from the user, but wouldn't it be useful
if we could do different things depending on what the user typed in? Well this
exactly as previously described with these things called 'if' statements. These
conditions.
The first thing we're going to learn about is the 'if' itself. Just write
the if keyword and then in some brackets, the condition. To specify the
condition you simply write one value (either a variable or constant), then the
comparison operator you want to compare them with (for example - equal to,
which is == ) and then the second value (either a variable or constant). We
then put some curly brackets, and anything inside the curly brackets is what
will be executed if the condition is true. For example, the following would
always true)
C++ Conditions and If Statements
C++ supports the usual logical conditions from mathematics:
Write a simple program that demonstrate the use of if statement (conditional statement if) with sign
greater then.
program #2
write a simple program that demonstrate the use of if statement (conditional statement if) with sign
less than.
Program #3
Write a simple program that demonstrate the use of if else statement (conditional statement ) with sign
less than and greater than .
Program #4
Write a simple program that demonstrate the use of if else statement (conditional statement) with sign
less than and greater than.
Program # 5
Online compiler
https://www.programiz.com/cpp-programming/online-compiler/
https://www.w3schools.com/cpp/trycpp.asp?filename=demo_if2
https://www.programiz.com/cpp-programming/if-else
Run at least four program related to if and if else statement and add
to your lab manual document.