3.16 Lessons Summary

Source: Internet
Author: User
Tags switch case

Additional
C # source code, by the C # compiler, compiled into the coding (IL)
int16=short.....±32000
INT32=INT.......±21 billion
int64=long......±922 billion 3372 trillion
IndexOf () ... LastIndexOf ... Returns if 1, not found

Cast ... parse.....convert ... ()

The plus sign indicates stitching when encountering a string
An equal sign is an assignment number
The two equals sign is the true equals sign.
Datime class, Value type ... Because there are addition and subtraction operations
Decimal d = 3.14m;//When writing code, the default input decimal number is double type, you must add a suffix m/m
float F = 3.14f;

In the branch statement, switch case
Switch case can be converted directly to the form of if else
If else cannot all be converted to switch case

The parentheses following the switch do not accept decimal type values
The value following the case must be a constant or constant name, not a variable
const int a = 2;

Variable name naming rules
A-z...a-z ... 0-9..._ ... Composition
Numbers cannot be placed at the beginning of the position
Spaces are not allowed in the middle of a variable name
Variable name cannot use keyword: int true break for class//to use to add a number after

Array... Reference type

Classification of statements
Sequential statements, SELECT statements, loop statements
Select: if () {}
if () {}else{} ... Two Choice One
if () {}else if () {}else{} ... Choose one More
If nesting ... Contain small situations in large environments
Switch () {case ... Every case needs to have a break}
Looping statements
For () {} ... Initial conditions, cyclic condition, cyclic body, state change
while () {.... State Change}
Do while () ..... ..... Do it again, and then look at the unsatisfied

Cyclic problem solving types: exhaustive and iterative
Exhaustive: Go through all the circumstances and use if to filter out the conditions that are met
Iteration: Solve the intermediate condition according to the result, until the initial result is obtained.

Index starting from 0
Intercept string substring (a) Start interception from a index until the end
Substring (A, b) intercept from the A index, intercept a length
Decide whether to include ... contains () ... bool type//return value is True/false
You can also use indexof or LastIndexOf ... A return value of 1 means no

Math
Take rounding Round
Special case: In the case of odd. 5, take the online ceilling, even. 5 Remove the line floor

Array
Index starting from 0
One-dimensional array, as a row
Two-dimensional arrays, table styles
Three-bit array, building
Bubble sort, for loop nesting

Function
1.void HS () {} ... No return without reference
2.void HS (int a) {} ... No return and no reference
3.int HS () {return 1} ... Return without parameter//return only one value is returned
4.int HS (int a) {return 1} ... Have a return to the ginseng
5.out ... Multiple values can be retrieved
Pass the value, only the value of this variable is taken away, not returned, unless return is assigned value.
Passing the value of a to a function, regardless of how the value changes in the function, does not affect a in main

The value of this variable is removed and returned (without return, with out).
Pass the value of a to the function, how this value changes in the function, and a in main will also change
Equivalent: This value in the function is the shortcut to this a in main

3.16 Lessons Summary

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.