);}Output information for all elements in the struct arrayvoid Printallstudent (Student * stus, int count) {for (int i = 0; i Printstudent (Stus+i);}}Sort by name Ascendingvoid Sortascendbyname (Student * stus, int count) {for (int i = 0; i for (int j = 0; J if (strcmp (Stus[j].names, Stus[j+1].names) > 0) {Student temp = stus[j];STUS[J] = stus[j+1];STUS[J+1] = temp;}}}}In descending order of agevoid Sortdescendbyage (Student * stus, int count) {for (int i = 0; i for (int j = 0; J if (Stus[j].ag
A go language for loop has 3 forms, only one of which uses semicolons.Package MainInPort"FMT")FNNC Main () {For i:=0;iFmt.println ("%d,i")}}Dead loopFunc Main () {for {Fmt.println ("Dead Loop")}}Add a loopFunc Main () {I:=5For i>0{I=i-1Fmt.println ("%d,i")}}The switch of Go is very flexible. An expression does not have to be a constant or an integer.Func main (a int) { Digital Switch A {case 1: FMT. Println ("1") Case 2: FMT. Println ("2") Case 3: FMT. Println
block executed; }The second type of format:if (conditional expression) { code block executed; } Else { the code block executed; }The third type of format:if (conditional expression) { code block executed;} Else if (conditional expression) {if)else{ execute code block; } Note: 1. Once a conditional expression is met, it goes into its execution statement block execution and does not execute the conditional statement once it finishes executing.2, if more than one conditional
statement can be an expression, cannot be empty, and the compilation can determine the type, and once initialized, only this type can be stored.
VAR can only declare local variables, can not be global, and can also be used in foreach, for, using, and other statements.
An initialization session cannot be itself an object and or a collection initializer, but it can contain an object or a new expression of the initializer.
3. Anonymous type1. What is an anonymous type?An anonymous typ
character.Implicit Razor expression
The implicit Razor expression starts"@"Symbol followed by C # code, for example:
Note: Implicit expressions cannot contain spaces. Otherwise, the analyzer reports the following error:
There is a space or line break behind the "@" character. Only valid identifiers, keywords, comments, and "(" and "{" are valid at the beginning of the code block, and they must be followed by "@" without spaces.
DisplayType
Expression
An explicit expression that contains a pair
var keyword indicates that the compiler can infer the actual data type through the initialization part on the right.
The expression type cannot be null during compilation.
The initialization statement can be an expression, cannot be null, and can be compiled to determine the type. Once initialized, only this type can be stored.
Var can only declare local variables, not global. It can also be used in statements such as foreach, for, and Using.
Initialization cannot be an object or a set init
Directory
Grammar
For loop
If statement
Switch statement
Defer statements
Defer stack
Conclusion
Preface: The second chapter of Go language, mainly about the grammar of Go language, such as loop, if judgment, Swich statement, defer statement, defer stack, and so on, each syntax is compared with the syntax in Java, each provides a combination of concept + example, Examples can be run directly.B
variables, but with only one member static variable, this member static variable is applied by multiple objects.9. Operators10. Process Control Statements1). Looping statementsA.while (conditional judgment statement) {}Only false when it jumps out of the loop.B.do{}while (conditional judgment statement);The code block is executed at least once, and only if it is false, it jumps out of the loop.C.for statementsfor (initial statement; Logical statement; Iteration statement) {Statement or statemen
the calculation problem, Start thinking, how to make a quiz;
2. Start the quiz:At the beginning, or with the topic of the topic, considering the complexity of the "if-else" statement, we chose the "Swich statement", because, this can be human interaction, on the one hand can achieve the input we need to a number of orders, you can complete the order of the question; the idea is that, first, use the assignment to the symbol , for the subtraction
: The Swich statement starts at the case label that matches the option value until the break statement is encountered, or until the end of the Swich statement is executed. Interrupt Control Flow statement: The break statement used to exit the Swich statement can be used to exit the loop statement as well. 3.9 Large values Java can be used if basic integers and fl
the menu. The Swich statement determines whether the clicked control is a level two menu or a primary menu. If the center of the first-order menu is clicked, determine if the level three menu is open. If the level three menu is open, hide the level menu and level two menu and modify the status. If the level three menu is hidden, determine if level two menu is hidden. If the level two menu is open, the level two menu is hidden. If level two menu is hi
mode 5. alter database openIn general, change the non-archive mode and automatic archive mode of the database to take effect 6. view the archive mode in archive log list www.2cto.com 7. The backup work can start to assume that the current database performs some backup work. SQL> alter tablespace tt begin backup; start to back up a table Tablespace alter physical operating system command can be tt. copy dbf to c:/temp. Physical BACKUP to a path SQL> alter tablespace tt END BACKUP; Tablespace alt
;%d integer output%s string output%f single-precision output%o octal form output% long character form output%e exponential output%x hexadecimal unsigned output%ul unsigned long shaping output6. The relationship between operators (! Non) "Arithmetic operation" relational operation "logical operation" copy operation)7. (1) if (judgment condition) statement 1Else Statement 2;Note: expression 1 is true, 2 is true, only statement 1 is executed, statement 2 is not executedif (1The general correct nota
C language: a typical case that involves the pointer function return value and printf garbled and memory stack. A typical case of printfA strange C language problem involves pointers, arrays, stacks, and printf. The following implementation: converts Integers to strings, returns string pointers, and CALLS printf in the main function for display.
#include
#include
#include
char* switch(int n)
{
char A[20],B[20];
char*p;//=(char*)malloc(4*sizeof(char));
int i=0,a;
Assignment Statement box.property = 100;Method invocation statement Box.method ();Branch statement Condition Branch statement if{} else{}Multi-branch Statement Swich () {Case N: ...}Second, if statementThe IF statement is a conditional judgment statement with a total of three formats:1.if (conditional expression) statement;var box = 100;if (box>50) alert (' box is greater than 50 ');//A line of if statement that executes a statement after judgmentvar
structure. However, the author believes that the idea of automatic refactoring should be "reconstruction work assisted by tools", and people still undertake most reconstruction work. I. PreparationsThis article uses the example in chapter 1 of Refactoring: Improving the Design of Existing Code. The code before reconstruction and the code after each reconstruction can be found in the attachment. Readers are better at reading this article with Refactoring: Improving the Design of Existing Code.E
*) sender; BOOL setting = whichSwich. isOn; [leftSwitch setOn: setting animated: YES]; [rightSwitch setOn: setting animated: YES] ;}- (void) dealloc {[sliderlabel release]; [leftSwitch release]; [rightSwitch release]; [super dealloc] ;}@ end3. The remaining are connection operations and output ports:Connect the value changed event of the slider control with the sliderChanged method, and connect the value changed event of the swich control with the sw
believes that the concept of automatic reconstruction should be "tool-assisted reconstruction work", and people still undertake most of the reconstruction work. First, preparatory workThis article uses the example in chapter one of the book "Refactoring:improving The Design of Existing code". The code before refactoring and the code to refactor each step are shown in the attachment. Readers are best to read this article in conjunction with the book refactoring:improving the design of Existing
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.