Write code also to read, love the whole stack, more love life. Daily update of original it programming techniques and daily practical videos.
Our goal is: To play with the server Web development, to understand the mobile side, the computer client is a cinch.
This tutorial is a basic tutorial for anyone who is interested in learning software development. Of course, because of the coherence of technology, it is recommended to view in order.
Last class: Computer small white learning software development-c# Choice statement, exception capture, offensive programmer
Course list: Because the headlines can not be customized catalogue, we are concerned about: "Do the full stack siege Lion" public number. Reply to ". NET directory" and get it. The public number also contains a lot of learning tutorials, waiting for you to come ~
This series of tutorials is about C # syntax. For specific development tools and basics, it is recommended to view previous tutorials.
The last time you were explaining an IF condition statement. Review the big question:
The SELECT statement is based on the criteria, select the specific part of the code that should be executed.
The condition is not set up in fact there is a data type. He is a bool. BOOL consists of only two values, True (True) and False (false). For example, you can assign values like this:
The value that is compared by the logical operator is the bool type.
Common logical operators:
Give me a question for you to do:
Please compile the program to determine whether the input positive integer is both 5 and the integer multiples of 7. If so, the output is yes;
Input Fahrenheit Celsius, convert it to the temperature of the layer Celsius and output (conversion formula c= (5*F)/9+32)
Enter two numbers to output their maximum value.
To find the trapezoid area. The upper and lower floor heights are 3,4,4 respectively.
Enter three integers x, y, Z, please put these three numbers from small to large output.
The specific code is concerned with the public number and will be explained in the next course.
First, the circulation
Go to the content of this lecture: cycle.
Loops, so the name Incredibles is the syntax for looping through a piece of code. We can use this code to achieve the effect of bulk code execution.
1. While loop
Is the calculation of the number of 1-100 integers.
While can be understood as the meaning of "when". You can see that the whie is followed by parentheses. That's right. The contents of this parenthesis also indicate the condition. The conditional usage explained in the if is still available here.
If the condition is true, the contents of 2 are executed. After the execution of 2, then to determine whether 1 conditions are established. Establishment continues to execute 2. Otherwise, 3.
is also based on the criteria to determine whether to execute the code.
For example, we can output 10 "Do full stack siege Lion" string. :
Effect:
I in this, is purely to control the number of cycles.
Then 1-100 and the program can understand this:
In: i = i+1 sum = sum + i in the form of code can be abbreviated to
I+=1, sum+=i, are also valid for other operators such as:
i = i*5:i*=5 i = i-5: i-=5
For the special form of i+=1, it can be shortened to i++
2. Do.....while Cycle
Calculate between 1-100 and the following:
Do and loop flow:
The content of 1 is executed by default. After execution, determine whether condition 2 is established.
1 of the content will continue to be established
If it is not established, it shall proceed as permitted.
In fact, the difference from while is that the do-while loop executes the code once regardless of whether the condition is established. The while condition is not enforced.
3. For loop
Calculate between 1-100 and the following:
For loop execution Process:
First do 1
Then determine whether the condition 2 is established.
If the contents of the execution loop are set up. Which means 3.
3 Execution is complete 4
4 execution completed, determine whether the condition 2 is established
Set up then execute 3, otherwise jump out of the loop and do the following 5
If it does not, jump out of the loop to execute the following content.
Here are a few more contact programs, and it's recommended to consider:
After-school practice topics:
Calculates the sum of odd sum and even numbers between 1-100
Calculate 1+1/2+......+1/100
Enter a three-digit number to output their single-digit, 10-digit, and hundred-digit numbers.
Seeking 1*2*3*..........*n. Cycle
1+2+3+4+6+7+8+9+11++.+99= (multiples of 5)
In order to satisfy the largest n in the 1+2+3+...+n<500, and to find and write program implementation.
This article by doing full stack Siege Lion original debut, if reproduced please declare the source.
WX platform: Make full stack siege Lion, submit Wx:aiquanzhan
Computer small white self-taught software programming-. NET syntax basics of looping statements, pure tips dry