C # programming: Input and Output,
C # Programming
Main Function
Static void Main (string [] args)
{
}
The program must be written in braces of the main function.
I. Output:
Console. WriteLine ("string to be output ");
Note:
1. case sensitive.
2. All symbols must be in English.
3. Do not miss the semicolon.
Console. Write ("the string to be output"); // No line breaks will be generated later.
Example
Ii. input:
String s = Console. ReadLine ();
String-string type
S-A container dedicated to storing string content
=-Assign a value to send the right to the left.
Console. ReadLine () -- read the input content from the Console.
This sentence means:
Read your input content from the console, and put the read content in a container s that specifically stores the string content.
Example
3. Comment: Method 1: select the corresponding row and click "comment selected row" in the toolbar ". Method 2: select the corresponding row and press Ctrl + K Ctrl + C; uncomment: Ctrl + K Ctrl + U method 3: manual comment. Add // (comment a whole line)/***/comment a piece of content before the code line.
Tip: 1. Try to use the smart sensing function for written code. 2. Write the overall information first, and then complete the details. 3. The word function is automatically completed. Alt + right cursor
Case: Enter the name, age, and unit. The sentence is displayed as a smooth sentence.
Example