int a = 5;
a++;
++a;
Console.WriteLine (a);
Console.ReadLine ();
int a = 5;
int b = ++a;//a=a+1;int b=a;
int c = A++;//int c=a;a=a+1;
int b = a++;
int c = ++a;
Console.WriteLine (A + "\ t" +b+ "\ T" +c);
Console.ReadLine ();
int a = 8;
A + = 5;//a=a+5;
Console.WriteLine (a);
branch
format 1:if () {} If satisfied, skip
format 3:if () {} else if () {} ... else{} multiple Select a
format 4:if nested after a wide range of rules what's the small case
switch case in relation to the format of the multiple-choice one
all switch Case can be written as if else
but not all if else can be written as switch cases
Looping statements
Four elements: initial conditions, cyclic condition, cyclic body, state change
For loop
for (int i = 0; i < 5; i++)
{
Console.WriteLine ("Hello");
}
Console.ReadLine ();
Nesting for loops
Print matrix
for (int i = 0; i < 5; i++)
{
for (int j = 0; J < 5; J + +)
{
Console.Write ("");
}
Console.WriteLine ();
}
Console.ReadLine ();
Types of problems that loops can solve
Exhaustive: Go through all the possible scenarios and use if to filter out the required conditions
Iteration: Using the existing conditions to solve the intermediate situation, and finally deduce the results
While loop
int i = 0;
while (I < 5)
{
Console.WriteLine ("Hello");
i++;
}
Do While
Regardless of the expression after the time, you need to go through the first step
int a = 5;
do{
Console.WriteLine ("Hello");
}while (A>10);
Console.ReadLine ();
function Format
Format 1: No parameter no return public void Hanshu () {}
Format 2: No parameter has return public int Hanshu () {return 1;}
Format 3: The parameter is returned to public int Hanshu (int a) {return 1;}
Format 4: Parameter no return public void Hanshu (int a) {}
C # general Review