Conditional Statements (if, else)
What is a Conditional Statement?
Conditional statements are used to make decisions in a program based on conditions.
Types of Conditions
- if
- if-else
- else-if ladder
Example
int age = 18;
if(age >= 18) {
cout << “You can vote”;
} else {
cout << “You cannot vote”;
}
Use Case
Used when your program needs to take decisions
