2010-05-31 73 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」;