Example 1
Solution: ConsoleApplication
Project name: leleapplication
File Name: Program. cs
Using System; using System. collections. generic; using System. text; namespace ConsoleApplication {class Program {static void Main (string [] args) {/* Console. writeLine ("hello"); string s = Console. readLine (); // when the user inputs text, it is paused. After the user inputs the text, press enter to return the user input and declare a string variable container.) s, use s to put the value returned by the ReadLine function. Console. writeLine (s + "hello"); */int i1 = 10; int i2 = 20; // Console. writeLine (i1 + "+" + i2 + "=" + (i1 + i2); // The placeholder starts from 0, the sequence starts with the second parameter of WriteLine // Console. writeLine ("{0} + {1} = {3}", i1, i2, i1 + i2, "aaa"); // string. format () Console. writeLine ("Enter the boy's name"); string boy = Console. readLine (); Console. writeLine ("Enter girl's name"); string girl = Console. readLine (); Console. writeLine ("{0} love {1}", boy, girl); // int i3 = "3"; // error, "3" just looks like a number, it is still a string // string boy = Console. readLine (); // error. The variable cannot be named again boy = Console. readLine (); // yes. Instead of redefining the boy variable, use the existing variable // boy = 3; // No, once the type is determined, no value can be assigned to other types of Console. readKey (); // press a key to continue execution }}}
Example 2
Solution: leleapplication1
Project name: leleapplication1
File Name: Program. cs
Using System; using System. collections. generic; using System. text; namespace ConsoleApplication1 {class Program {static void Main (string [] args) {/* int I = 10; Console. writeLine ("I"); // I and "I" only look the same. string name = Console. readLine (); Console. writeLine ("name hello"); // error Console. writeLine (name + ""); */string s = "\" AB \ ""; Console. writeLine (s); Console. readKey ();}}}
This article from the "white clouds out of this unintentional" blog, please be sure to keep this source http://chenbaiyun.blog.51cto.com/7361557/1300729