日期:2014-05-17 浏览次数:20902 次
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { string strInput = Console.ReadLine(); Console.WriteLine("输入的内容是:{0}",strInput); Console.ReadKey(false); } } } using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { Console.WriteLine("请输入一个字符:"); char c = Console.ReadKey().KeyChar; Console.WriteLine("\r\n字符{0}的ASCII值是:{1}",c,(int)c); Console.ReadKey(false); } } } using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { double y; Console.WriteLine("请输入一个整数:"); double x = double.Parse(Console.ReadLine()); if ((int)x == 0) { Console.Write("f(x) = 0"); } else { y = 1 / x; Console.Write("f(x) = {0}", Math.Round(y,2)); } Console.ReadKey(false); } } } using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { double y; Console.WriteLine("请输入一个整数:"); double x = double.Parse(Console.ReadLine()); if ((int)x == 0) { Console.Write("f(x) = 0"); } else { y = 1 / x; String result = y.ToString("#0.0"); Console.Write("f(x) = {0}", result); } Console.ReadKey(false); } } }