日期:2014-05-17 浏览次数:20515 次
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string[] s = { "正常", "故障" };
for (int i = 7; i >= 0; i--)
{
char[] bits = Convert.ToString(i, 2).PadLeft(3, '0').ToCharArray();
string item = "";
for (int j = 0; j < 3; j++)
{
if (bits[j] == '1')
item += (j + 1).ToString() + s[0] + " ";
else
item += (j + 1).ToString() + s[1] + " ";
}
item = item.TrimEnd();
Console.WriteLine(item);
}
}
}
}