C # Second Lesson

Source: Internet
Author: User
Tags word wrap

Using System;
Using System.Collections.Generic;
Using System.Linq;
Using System.Text;
Using System.Threading.Tasks;

Namespace ConsoleApplication1
{
Class Program
{
Main is the entry of the program, the main function

static void Main (string[] args)
{
Output
Console.Write ("This is my first program!") ");
Console.WriteLine ("This is my second line of code! ");
Console console command

Input
string defines a type
There must be parentheses behind the method
AutoComplete Word function ALT + RIGHT CURSOR key
Console.WriteLine ("Please enter what you want to enter:");
Receive all characters before you receive the Enter command directly
An equal sign means that the copy is good
string s = Console.ReadLine ();//Enter before entering the carriage
The plus sign then encounters the string type as a concatenation action.
Console.WriteLine ("The content you just entered is:" +s);
Case: Enter name, age, work unit, integrate into a sentence fluent expression
Console.Write ("Please enter Name:");
String name = Console.ReadLine ();
Console.Write ("Please enter Age:");
String age = Console.ReadLine ();
Console.Write ("Please enter work unit:");
String Danwei = Console.ReadLine ();

Console.WriteLine ("I Call" +name+ ", this year" +age+ ", I" +danwei+ "work");
Console.ReadLine ();
}
}
}

The class class using represents the library referenced by the program, the following system, and so on, represented as consoles these libraries are provided by the. NETFramework static void Main (string[] args) is a method string[] is a nested array of main master routines Sequence, program entry, Priority execution namespace namespace

Console is the console command read input, write output, after adding line for word wrap, Alt + right to AutoComplete words, ctrl+f5 start execution,(red Word for actual operation and handout, or the teacher did not speak in the handout) Ctrl+e, Then press CTRL + C to annotate the bank, Ctrl+e, and then press Ctrl+u to uncomment the line; Shift+delete delete a row; ctrl+x cut one line; Ctrl+shift+space place the cursor in the method function bracket is used, display overloaded ; Comment one line;/* Comment out the middle content */; Separate multiple variables that declare the same class in a row, such as int A, B, (declare the variable type, separated by commas); In the same statement, you cannot declare the same variable name to the same type two times, for example: int a=34;int a=22; (error);

C # Second Lesson

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.