Output
Console.WriteLine (" Mosimose ");
Console.Write("Hollo"); with no carriage return.
Attention:
1. note case sensitive. (shortcut key operation)
2. brackets, quotation marks, and semicolons are all symbols in the English state.
3. don't forget to write a semicolon at the end.
4. after wrench =. Block after ()
String strings
input
String N=console.readline ();
How do I stitch strings?
Console.WriteLine(" your username is " +u+ ", the password is " +p+ ", please confirm.) ");
Other content
Console.forefroundcolor = consolecolor.red; Set Text color
Console.forebankcolor = consolecolor.red; Set Background color
Console.clear (); Clear Screen
Show
**********************************************************************
First, the data type:
String--- to put a string of characters. You need to use " " to draw up.
String a = "456"
string s = "789"
Console.WriteLine (A+s);
integral type (int4 bytes) --- integer type no quotation mark long ( 8 Span style= "font-family: the song Body;" > byte 2 bytes) tiny (micro-integer 1 byte"  
1 bytes (B)=8 bit 1b=8b 1Byte = 8bit
1kb=1024b 1mb=1024kb 1GB=1024MB 1TB=1024GB
int a = 456;
int b = 789;
Console.WriteLine (A+B);
Decimal type, float type (float,doubli)
FLOAT: single-precision floating-point type. 4 bytes
double: dual-precision floating-point type. (normal use) 8 bytes
Double d = 3.14;
float C = 3.14f;
Boolean (bool): Logical type, either or. true , false ;
BOOL B = true;
bool d = false;
Character type (char): Single character single quotation mark
char c = ' 4 ';
Second, the variable (can be changed)---the process of running, the value can change the amount.
Defined first, then used.
When you define a variable name, you cannot duplicate it.
(a) Definition:
Data type variable name [= value ];
int A;
int b = 29;
(b) Assignment:
Variable name = value ;
(c) Value:
By using the variable name directly, you can take the value that exists in the variable.
(iv) General rules for naming variables
1. variable names are generally composed of letters, numbers, and underscores.
2. the variable name can begin with a letter or an underscore.
3. variable names cannot be duplicated with system keywords. Keywords can't turn blue
Three, constant (non-modified)---The process of running, the amount of value can not be changed.
Literal constants.
Symbol constants. const INT ABC = 2; Definition: Add the const keyword to the left of the variable definition .
Note: Symbolic constants must be assigned when they are defined.
Application of Symbolic constants: in some of the repeated use of complex data, generally like to use represented instead of it, using constants for programming operations.
Iv. type Conversion
Computers can only operate on the same type of data, and different types of data cannot be directly computed, and if they are of different types, they need to be converted (auto, force).
int a = 10;
Double b = 3;
Console.WriteLine (A/b); first , the value of A is changed to decimal type 10.0000, and then the division operation is done.
Automatic conversion: The computer automatically converts the type according to the operation data. The principle is that as long as the type is not lost data, it is transformed.
Tiny_>short_>int_>long_>double
Cast: A programmer forces a type to become another type. This coercion is implemented when the computer does not automatically convert, but it is possible to lose data.
Grammar:
1. add parentheses to the left side of the converted data, and write the target type to be converted.
int a = (int) 3.14
2. Use convert.toxxx () conversion.
int a = 10;
Double b = 3.0;
int c = A/convert.toint32 (b);
string s = "7896";
int n = convert.toint32 (s);
Example 1. : console.write ("Please enter your Age:");
String a = Console.ReadLine ();
int s = Convert.ToInt32 (a);
Console.WriteLine ("You next year" + (s+1) + "years old");
Example 2. : 1 , int a = 10; C is an integer
int b = 3;
int c = A/b;
Console.WriteLine (c);
2, int a = 10; C is decimal
Double b = 3;
Double C = A/b;
Console.WriteLine (c);
3, int a = 10; C is an integer
Double b = 3;
Double C = A/b;
Console.WriteLine ((int) c);
4, int a = 10; C is an integer
Double b = 3;
int c = A/(int) b;
Console.WriteLine (c);
5, int a = 10; C is an integer
Double b = 3;
int c = A/convert.toint32 (b);
Console.WriteLine (c);
Example 3: Turning a string into an integer
String a = "1233";
int s = Convert.ToInt32 (a);
Console.WriteLine (s);
C # input and output and basic types