65.7k views
1 vote
. Else-if is good selection statement that help us to solve problems in C++,mostly times same problem of same nature can also be solved via switch statement. Which one you prefer to use and why?

User Tesmojones
by
7.1k points

1 Answer

7 votes

Answer:

Else-If statements

Step-by-step explanation:

Personally, I prefer using Else-If statements for conditional statements since you can start with and If statement and add to it if necessary. Aside from this, Else-If statements also allow you to add more than one condition to be met by using tags such as and or and not. Switch statements are better in scenarios where you have a set of possible inputs or results and need a specific event to happen for each input/result, but this is not as common of a scenario so Else-If is usually my go-to conditional statement.

User Arnoud Kooi
by
6.3k points