Output statement console.readline ();
Input statement Console.WriteLine ();
add annotations to functions;
/**///Area
Data type
1, int integer;
2, floating-point double;
3, String type;
4, Boolean bool (1) True (2) false;
C # escape character
(1) \ nthe newline (2) \ r Enter (3) \ t Horizontal tab
Operator
(1) Gaga + + +
(2) minus minus--
(3) multiplication to take surplus */%
(4) plus minus-
(5) greater than +; >; less than <; Greater than or equal to >=; less than equals <=;
(6) equals = =; not equal to! = =;
(7) and (and) &&;
(8) or | | ;
(9) Non-!;
(1) previous + + explanations;
(2) after + + + explanation; plus repeated self-added
Examples
Numbers within 1,100 and 7
Console.Write ("Please enter a number within 100");
int s = Convert.ToInt32 (Console.ReadLine ());
if (s%7==0| | s%10==7| | S/10==7)
//{
Console.WriteLine (s+ "With regard to 7");
//}
else if (true)
//{
Console.WriteLine (s+ "unrelated to 7");
//}
Console.ReadLine ();
//Examples
////2, Calculator
//console.write ("Please enter a number");
//int a = Convert.ToInt32 (Console.ReadLine ( ));
//console.write ("Please enter a number again");
//int b = Convert.ToInt32 (Console.ReadLine ( ));
//int C = a + B; The result of
//console.writeline (a+b+ ") is" +c ";//Arithmetic addition, Multiplication becomes *, division becomes/, subtraction becomes-;
Grammar
SELECT statement If,else;switch case;
Cyclic statement do,for;foreach;while;
Jump Statement Break,continue,return;
Exception statement try catch, finally;
Examples
1, enter a positive integer to determine if it is not a positive integer
Console.Write ("Please enter an integer");
int a = Convert.ToInt32 (Console.ReadLine ());
if (a>=10&&a<100)
//{
Console.WriteLine ("Then this number is a positive integer");
//}
if (a < 10)
//{
Console.WriteLine ("Then this number is negative");
//}
Else
//{
Console.WriteLine ("You have entered a number greater than or equal to 100");
//}
Console.ReadLine ();
2, enter the score to determine whether the pass,
Console.Write ("Please enter name");
String a = Console.ReadLine ();
Console.Write ("Please enter a score");
int b = Convert.ToInt32 (Console.ReadLine ());
if (b>=80&&b<100)
//{
Console.WriteLine ("You learn well, deserve praise");
} if (b>50&&b<=60)
//{
Console.WriteLine ("Just a little bit, refueling");
} if (B<50)
//{
Console.WriteLine ("Try hard, don't be lazy");
//}
Console.ReadLine ();
3, one-yuan two-time equation
ax*x+bx+c=0;
4, Standard weight
Console.Write ("Please enter gender");
String S=console.readline ();
Console.Write ("Please enter weight (kg)");
Double t=convert.todouble (Console.ReadLine ());
Console.Write ("Please enter height (cm)");
Double g=convert.todouble (Console.ReadLine ());
if (s== "male")
//{
Double n=t-g+100;
if (n>=-3&&n<=3)
//{
Console.Write ("You are the standard weight");
//}
else if (n>3)
//{
Console.Write ("You need to lose weight");
}else
//{
Console.Write ("You're too skinny");
//}
//}
else if (s== "female")
//{
Double N=t-g +100;
if (n>=3&&n<=3)
//{
// {
Console.Write ("You are the standard weight");
//}
else if (n>3)
//{
Console.Write ("You need to lose weight");
}else
//{
Console.Write ("You're too skinny");
//}
Console.ReadLine ();
C # Base 1,100 within the 7-related numbers; 2, calculator, 3, judging is not a positive integer, 4, judging weight