One vs basic applications
(i) New project
There are several ways to create a new project, such as:
1. Create a new project on the VS start Page
2, in the integration environment, through the "file"/"New"/"project", The New Project dialog box appears, where you select c#-Console application-Framework FRAMEWORK4, complete the new
3. In the open project, right-click/Add/New project in Solution Manager
(ii) BASIC applications
1, in Tools/Options/environment/general can set themes, fonts and colors can set the code font color in the project
2, in the text editor/c# can set the line number
Two C # basics
The completion of a new project has five elements: C #, Frame 4.0, console application, save location, file naming
The completion of the code is mainly done in the main function, the main function has four elements: name, input, output, processing
(i) Output
Console.WriteLine ("What to write");//output content, wrap, or cursor at the next
Console.Write ("content");//Do not wrap, that is, the cursor in the rear
Console.ReadLine ();//wait for input, enter content to continue, prevent flash back
For example:
Console.WriteLine (" keyboard knocking "); Console.WriteLine (" over million monthly salary "); Console.ReadLine (); Console.WriteLine (" keyboard ash "); Console.ReadLine (); Console.WriteLine (" home beggar "); Console.ReadLine ();
(ii) input
1, if you have output in the code want content is Console.ReadLine (); only as a complete code output of the program to prevent the flash back, no significance.
2. Input variable, complete output
(1) Defining variables
First, define a variable A, then assign the value a= input console.readline (), enter the content you want to input, and then output, the variable can be input or any character. For example:
string a = console.readline (); string " , Hello! "; string c = a + b; Console.WriteLine (c); Console.ReadLine ();
Note: the "+" here is a combination of two sentences, and how is the data addition and subtraction implemented?
It is necessary to make use of integer variable int to compute the integer variable A, and then assign the value a= any number to realize the operation.
For example:
int 1 ; int 2 ; int C = a + b; Console.WriteLine (c); Console.ReadLine ();
Two different variable operations are implemented, and can be converted between them?
If the string is a number that can be converted, first define the string a= "any number", and then define the int b=int. Parse (a)
Comprehensive Walkthrough:
Console.Write (""Please enter your name:""); stringA =Console.ReadLine (); Console.Write (""Please enter your gender:""); stringb =Console.ReadLine (); Console.Write (""Please enter your age:""); stringc =Console.ReadLine (); Console.Write (""Please enter your height:""); stringD =Console.ReadLine (); Console.Write (""Please enter your weight:""); stringE =Console.ReadLine (); Console.WriteLine (""---------------------------""); stringf=a+"Hi there! Your gender is ""+b+"", your age is""+c+""Your height is""+d+""Your weight is""+e+"". "; Console.Write (f); intg =int. Parse (d); inth =int. Parse (e); intz = g +h; stringx ="your height and weight are ""+ z +"". "; Console.Write (x); Console.ReadLine ();
"2017-2-17" vs basic applications and C # Basics section I (Defining variables, inputs, and outputs)