Switch-case retrun break, switch-caseretrun
{
If statements process two branches, the if-else-if structure must be used when processing multiple branches. However, if there are many branches, the more nested if statement layers, the program is not
There are 32 keywords in the ANSI C standard C language, namely:Auto break case Char const continue default does double else enum externfloat for goto if int long register return short SIG Ned sizeof static struct Switchtypedef Union unsigned void
Switch syntax The code is as follows:Copy code Switch (expression){Case constant expression 1: Statement 1;....Case constant expression 2: Statement 2;Default: statement;} Default is to execute it if there is no matching case. default is not
http://m.blog.csdn.net/blog/tianyazaiheruan/8988420Today qnovations teacher in the use of switch, this design to the most basic content, may forget some of its basic grammar, there are some errors, so impromptu from a variety of data query summed up
The following is a simple method of Switch:
Switch (){Case B;} the value in Section A must be of the int type, or can be automatically converted to an int type expression. That is to say, Part A can be of the byte/short/Char/INT type. It should be
introduce
This article describes an attempt to switch-case a short string (less than 4) in C + +, as with an integer value, to avoid the overhead of string matching and slightly improve the efficiency of the operation. background
As you know, C + +
First, the principle is to explain the problem:switch (expression){case constant Expression 1: statement 1;....Case constant Expression 2: statement 2;Default: statement;}1.default is that if you do not have a matching case, default is not
The first question: When to use switch ' multi-branch, you can use a switch case when you need to use multiple if elseCase Planet score score, supports horizontal classification, vertical treatmentpublic static void Main (string[] args) {Scanner s =
The If statement handles two branches and uses the IF-ELSE-IF structure when dealing with multiple branches, but if there are more branches, the more nested if statement layers, The procedure is not only large but also difficult to understand.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.