What is a selection statement? Explain with help of complete C++ program.
Answers
Answer:
Selection statements allow a program to test several conditions, and execute instructions based on which condition is true.That is why selection statements are also referred to as conditional statements.
Answer:
A software can test many scenarios using selection statements, and depending on which condition is true, it can then carry out instructions. This is why selection statements are frequently referred to as conditional statements.
Explanation:
A decision in a programme results in a one-time jump to a new section of the programme. In C++, decisions are made in a variety of methods, but if.. else is the most crucial. remark that makes a decision between two options. Switch is another decision statement that, depending on the value of a single variable, provides branches for various alternative portions of code. if declaration A condition is evaluated by the if statement, and if it is true, a true-block (a statement or group of statements) is performed; if it is false, the true-block is bypassed. The if statement's basic grammar is as follows: if (expression) true-block; statement-x;
#SPJ2