using System;namespace ConsoleApplication2
{
class Class1 { static void Main(string[] args) {
Console.WriteLine("\n the first phnomenon:");
for(int x=-100;x<=100;x+=100)
{
Console.WriteLine("{0:000;-00000;'0'}",x);
}
Console.WriteLine("\nthe second phenomenon:");
for(x=-100;x<=100;x+=100)
{
Console.WriteLine("{0:正数:0;负数:0;零:0}",x);
}
Console.WriteLine("\n the third phenomenon:");
for(x=-100;x<=100;x+=100)
{
Console.WriteLine("{0:father:-0;mother:0;brother:0}",x);
}
Console.Read();
}
}
}
我是初学者,瞎改的!你试试!
{
class Class1 { static void Main(string[] args) {
Console.WriteLine("\n the first phnomenon:");
for(int x=-100;x<=100;x+=100)
{
Console.WriteLine("{0:000;-00000;'0'}",x);
}
Console.WriteLine("\nthe second phenomenon:");
for(x=-100;x<=100;x+=100)
{
Console.WriteLine("{0:正数:0;负数:0;零:0}",x);
}
Console.WriteLine("\n the third phenomenon:");
for(x=-100;x<=100;x+=100)
{
Console.WriteLine("{0:father:-0;mother:0;brother:0}",x);
}
Console.Read();
}
}
}
我是初学者,瞎改的!你试试!
console.writeline("正;负;0;",x)按照这个排一下顺序:)
to web_gus(penny):
不好意思,我还是有点不明白。x是首先=-100,然后0,然后100的,为什么-100最后输出呢,难道
x=-100时先不执行console.writeline操作吗
谢谢你的回复:)
Console.WriteLine("{0:正数:0; 负数:0; 零:0}",x);
Console.WriteLine("{0:father:-0;mother:0;brother:0}",x);
我就看出来第三种方法的“0:father:-0”,0的前面多了一个负号,所以到了第三中方法的时候出现了100,0,100的情况。是这个地方吗?