2010-05-31 60 views
0
for (int row = 0; row < SS; row++) 
     { 
      for (int col = 0; col < SS; col++) 
      { 
        identity[row, col] = (row == col) ? 1 : 0; 

       Response.Write(identity[row, col] + " "); 
      } 
      Response.Write("<br/>"); 
     } 

现在我的输出为1 0 0 0 1 0 0 0 1我想在C#中乘以符号L单位矩阵

我想输出为L 0 0 0 L 0 0; 0 L

+0

“L000L”,确实如此。 – 2010-06-01 03:58:52

回答

0

声明您的数组类型的字符串(或字符),并尝试这个办法:

identity[row, col] = (row == col) ? "L" : "0"; 
0

identity [row,col] =(row == col)? “L”:“0”;