日期:2014-05-18 浏览次数:21068 次
Console.WriteLine("{0} + {1} = {2}", x, y, x + y);
------解决方案--------------------
Console.WriteLine("{0} + {0} = {0}", x, y, x + y);
  这是什么玩意?
Console.WriteLine("{0} + {1} = {2}", x, y, x + y);
------解决方案--------------------
  static void Main(string[] args)
            {
                int x, y;
                Console.WriteLine("input:");         
                x = Convert.ToInt32(Console.ReadLine());
                y = Convert.ToInt32(Console.ReadLine());
                Console.WriteLine("{0} + {1} = {2}", x, y, x + y);
                Console.ReadLine();
            }
------解决方案--------------------
你的占位符写错了。。。
------解决方案--------------------
Console.WriteLine("{0} + {0} = {0}", x, y, x + y);
这一句 有问题...
------解决方案--------------------
Console.WriteLine("{0} + {1} = {2}", x, y, x + y);
Console.WriteLine第一个参数stringformat中{0}对应后面的第一个参数(就是x),{1}对应着后面第二个参数(就是y),以此类推。。。
所以你全部写的{0},最后输出的是个1+1=1