-1
我想从我的链表中打印出稀疏矩阵。这看起来是这样的:从链表中打印稀疏矩阵
0 0 0 0 0 0
1 0 6 0 0 0
4 0 0 0 6 0
但对于这一点,它只是打印出0与里面的值。 这是代码。
while (temp != NULL)
{
for (int i = 0; i < row; i++)
{
for (int j = 0; j < col; j++)
{
if ((row == (temp -> e).getRow()) && (col == (temp -> e).getCol()))
cout << temp ->e.getValue();
else
cout << "0";
}
cout << endl;
}
temp = temp -> next;
}
你是对的。我猜我忽略了它。谢谢。 – win 2013-02-15 09:22:29