Http://www.enet.com.cn/eschool/video/c_peng/
Single-line comment multi-line comment
/*
....
//*/
Section 3 variables
Type: Open up space from the memory, and the variable is stored in the space.
Int sum; sum. ToString () is converted into bytes.
A variable name must start with a letter and can only contain letters, numbers, and underscores (_).
Contains spaces, punctuation marks, operators, and other symbols.
Int @ int can be used
Section 4: constant const
Can I not initialize an uppercase constant for each letter? Cause: easy to modify at a glance
Constants (programming) and constants (Mathematics)
Const Double PI = 3.1415926; constant
Const String TXT = "must be awesome"; constant
Section 5
Basic Data Type
At the hardware level, the memory is only 0 and 1
In order to better manage and use the memory, we must know what is in the memory village.
Appearance data
Integer
Floating Point Type
Float Type number followed by F decimal type number followed by M otherwise treated as Double
Type Processing
Character char single character with single quotation marks string with double quotation marks
Section 6 Other data types (described later)
Array enumeration struct (possibly) Class interface delegate event
Var is not a type keyword.
Var integer = 10;
Var name = "ediundong ";
Var is just a keyword. It is not a new type, but is responsible for telling Compilation
To deduce the type of the Variable Based on the initialization expression.
Var integer; the error must be initialized.
Var integer = null; no space is opened in the memory and cannot be inferred. Therefore
Error.
Code:
// This. textBox1.Text = "happy"; Section 1
/* String theString; Section 2
TheString = "where are you ";
This. textBox1.Text = theString;
//*/
/* Section 3
Int sum;
Sum = 4 + 5;
This. textBox1.Text = sum. ToString ();
//*/
// Const Double PI; no value assignment allowed
/* Section 4
Const Double PI = 3.14;
Int r = 6;
Double area = PI * r;
This. textBox1.Text = area. ToString ();
//*/
/* Section 5
Int number1 = 10000;
Long num2 = 2000000;
Long result = num1 + num2;
This. textBox1.Text = result. ToString ();
//*/
/*
Float theFloat1 =-3.9F; // After initialization, uppercase F is added.
Float theFloat2 = 100; // although there is no decimal point, the space has been left out.
Float theDicimal = theFloat1 + theFloat2;
This. textBox1.Text = theDicimal. ToString ();//*/
/*
Decimal theDecimal = 10.55555555555 M; // If M is not added, it is treated as a Double type.
Double theDouble = 10.555555 //*/
/*
Char theChar = 'stream'; // single quotes
String str1 = "Lang Man"; // double quotation marks
String str = theChar + str1;
This. textBox1.Text = str;
//*/
/* Section 6 The var type must be initialized.
Var theInteger = 10;
This. textBox1.Text = theInteger. ToString ();//*/