using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace 课堂 { class Program { static void Main(string[] args) { /* //变量的定义 int num; //string st; //通过键盘任意输入一个数的说明 Console.WriteLine("请输入一个整数"); num = Convert.ToInt32(Console.ReadLine()); //st = num % 2 == 0 ? "偶数" : "奇数"; //Console.WriteLine("这个数是" + st); if(num%2==0) { Console.WriteLine("偶数"); } else { Console.WriteLine("奇数"); } double s; Console.WriteLine("请输入成绩"); s = Convert.ToDouble(Console.ReadLine()); if (s > 90) { Console.WriteLine("师父说:奖励一本武功秘籍"); }*/ { //a能被b整除,a+b>100。则输出a int a, b; Console.WriteLine("请输入任意两个整数"); a = Convert.ToInt32(Console.ReadLine()); b = Convert.ToInt32(Console.ReadLine()); if ((a + b > 1000) || (a % b == 0)) Console.WriteLine(a); else Console.WriteLine(b); } { //任意输入两个数求最大值 double c, d; Console.WriteLine("请输入任意两个数"); c = Convert.ToDouble(Console.ReadLine()); d = Convert.ToDouble(Console.ReadLine()); if (c > d) Console.WriteLine("输出的值是" + c); else Console.WriteLine("输出的值是" + d); } { //比较两个数大小,要求x>y double x, y, l; Console.WriteLine("请输入x的值"); x = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("请输入y的值"); y = Convert.ToDouble(Console.ReadLine()); if (x < y) { l = x; x = y; y = l; } Console.WriteLine("x的值是:" + x + ",y的值是:" + y); } /* { double t, g, n, y, h, s; Console.WriteLine("请输入t的值"); t = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("请输入g的值"); g = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("请输入n的值"); n = Convert.ToDouble(Console.ReadLine()); if((t>g)&&(g>n)) Console.WriteLine("t的值是:" + t + ",g的值是:" + g+",n的值是:" + n); else if((t > g) && (n>g)) { s = n; n = g; g = s; Console.WriteLine("t的值是:" + t + ",g的值是:" + g + ",n的值是:" + n); } if ((t < g) && (g > n)) t = g; y = g; t = y; Console.WriteLine("t的值是:" + t + ",g的值是:" + g + ",n的值是:" + n);*/ } } }
标签:Convert,判断,Console,C#,ToDouble,WriteLine,ReadLine,输入 From: https://www.cnblogs.com/bky-wang/p/18124603