The four elements of a function include: name, input, output, processing
Comment by://comment only one line;/**/note a region;
namespace ConsoleApplication6---------//namespace
{
Class program---------------------------//Classes
{
static void Main (string[] args)-----------//method, no semicolon required behind
{
Console.WriteLine ("");--------------------//Output statement, wrap line
Console.Write ("");------------------------//Output statement, do not wrap
String a = Console.ReadLine ();-----------//Input statement
/* Adder */
Console.WriteLine ("Please enter a number:");
String a = Console.ReadLine ();
Console.WriteLine ("Please enter another number:");
String B = Console.ReadLine ();
Console.WriteLine (A + "+" +b+ "=" + (int). Parse (a) +int. Parse (b)));
}
}
}
Data type:
First, the basic type
Integer int can only put a finite number of digits
Short
Long
Floating-point double the default decimal number is double
Float if the decimal is to be treated as float, you need to add the f,f suffix in the back
Character Char with single quote, only one character, except for escape characters
boolean bool can only be placed in True,false code only lowercase, and do not quote
Ii. type of reference
String double quotation mark, consisting of one or more characters
Type conversions:
1, automatic conversion as long as there is no data loss situation, will automatically convert
2. Forced conversion
For numbers to be converted it is worthwhile to add parentheses to the left, and the parentheses to write the type to be turned into.
For the string to be converted to the corresponding value: use parse; int A=int. Parse ("string");
Use convert; Double d= convert.todouble (s);
Escape characters:
\ "double quotation mark \ \ backslash \ n line break \ r enter \ t horizontal tab
Visual studio-c#-20160411