<
p>
1.C#编译器不考虑代码中间的空格、回车符或tab字符(这些字符统称为空白字符)。
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Chapter03 { class Program { static void Main(string[] args) { int myInterger; string myString; myInterger = 17; myString = ""myInteger" is"; Console.WriteLine("{0} {1}.", myString, myInterger); Console.ReadKey(); } } }
<p>
<br />
</p>
<p>
<br />
</p>
<p>
<br />
</p>
<p>
<a id="ematt:543" href="http://www.whatled.com/content/uploadfile/201309/10fb1380031228.png" target="_blank"><img title="点击查看原图" border="0" alt="3.png" src="http://www.whatled.com/content/uploadfile/201309/10fb1380031228.png" width="669" height="84" /></a>
</p>
<p>
<br />
</p>
<p>
<br />
</p>
<p>
<br />
</p>
<p>
<br />
</p>
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Chapter03 { class Program { static void Main(string[] args) { double firstNumber, secondNumber; string userName; Console.WriteLine("Enter your name:"); userName = Console.ReadLine(); Console.WriteLine("Welcome {0}!", userName); Console.WriteLine("Now give me a number:"); firstNumber = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("Now give me another number:"); secondNumber = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("The sum of {0} and {1} is {2}.", firstNumber, secondNumber, firstNumber+secondNumber); Console.WriteLine("The result of subtracting {0} and {1} is {2}.", firstNumber, secondNumber, firstNumber - secondNumber); Console.WriteLine("The product of {0} and {1} is {2}.", firstNumber, secondNumber, firstNumber * secondNumber); Console.WriteLine("The result of dividing {0} by {1} is {2}",firstNumber, secondNumber, firstNumber / secondNumber); Console.WriteLine("The remainder after dividing {0} by {1} is {2}", firstNumber , secondNumber , firstNumber % secondNumber); Console.ReadKey(); } } }
<p>
<br />
</p>
<p>
<br />
<p>
<br />
</p></p>