---
# System prepended metadata

title: Control
tags: [C++]

---

---
###### tags: `C++`
---
# Control
## If Single Selection

![](https://i.imgur.com/OqsRpfM.png)
### Usage
```C++=
if (condition)
{
    Starement...
}
```
## If Else Double Selection
![](https://i.imgur.com/E4IDu55.png)
```C++=
if (condition)
{
    Starement...
}
else
{
    Starement...
}
```
## Condition Operation
![](https://i.imgur.com/umQ0lge.png)
### Eg 1
```c++=
int a=0
cout<<a=1 ? "Yes" : "No";
```
> No
## Multiple Selection
### Else If
```c++=
if (condition1)
{
    Starement...
}
else if (condition2)
{
    Starement...
}
else
{
    Starement...
}
```
#### In C++ it will be seen that...
```c++=
if (condition1)
{
    Starement...
}
else 
{
    if (condition2)
    {
        Starement...
    }
    else
    {    
        Starement...
    }

}
```
>However, we favor to use former 
### Switch Case
```C++=
switch(various) {
    case condition:
        Starement...
        break;
    case condition:
        Starement...
        break;
    default:
        Starement...
        break;
} 
```
> if we don't use break，it will not break out 
> Instead, it will keep doing those instruction