So far, the previous programs can only be executed step by step.
Statement: Judge and loop to form program branches and loops.
Select Control: If, else, switch, Case
Loop Control: white, do, for, foreach
Jump statement: Break, continue
Exception Handling: Try, catch, finally
If is equivalent to a conditional OPERATOR:
Example
Else: Also
For example, judge whether a number is a two-digit integer.
If else nesting:
Enter the name and score to determine whether the score is successful,
If the value is greater than or equal to 80, "you have learned a good job and are worthy of praise !"
If it is less than 50, the output will be "hard work, don't be lazy !"
If the output is between 50 and 60, the output will be "just a little bit !"
Enter a decimal number and then round it to five:
Because it is a decimal number, you need to define the floating point type:
Take double as an example,
Read the input value A, subtract the integer a from the floating point A, and then judge the relationship between the value and the value 0.5.
That is, double A = double. parse (console. realine ());
Double C = A-(INT);
If C is greater than or equal to 0.5, 1 is entered. If C is less than 0.5, decimal places are removed.
Apply to definition, integer and floating point conversion, and other knowledge (with increasing increments)
Then
Equation: ax2 + bx + c = 0
Determine the root of the equation and solve it:
First, understand what is a quadratic equation,
If a is equal to 0, the equation is not a quadratic equation.
Use the formula: louta △ = b2-4 * a * C to judge the root condition:
△< 0 then the equation has no solution, △= 0 has two equal solid roots, and △> 0 has two different solid roots.
Another formula is used for solving the problem:
X = (-B ± √ b2-4ac)/(2 *)
√ The function math. SQRT () is required ()
Standard Weight:
Men's Weight = height-100 + 3, Women's Weight = height-110 + 3
The formula is changed to: Men's weight-height + 100 = ± 3 women's weight-height + 110 = ± 3
20141013 -- judgment Statement (if, else)