36 lines
1.0 KiB
C++
36 lines
1.0 KiB
C++
#include <iostream>
|
|
#include "SparseMatrix2D.h"
|
|
#include "ConstructionMaterial.h"
|
|
|
|
using namespace std;
|
|
|
|
int main() {
|
|
|
|
ConstructionMaterial a("nothing",0);
|
|
ConstructionMaterial b("Lumber", 6);
|
|
ConstructionMaterial c("nails", 9);
|
|
SparseMatrix2D<ConstructionMaterial> bigPointMatrix(10, 10, a);
|
|
bigPointMatrix.set(5, 5, b);
|
|
cout << bigPointMatrix.at(5,5).toString() << endl;
|
|
bigPointMatrix.set(5, 5, c);
|
|
cout << bigPointMatrix.at(5,5).toString() << endl;
|
|
|
|
|
|
SparseMatrix2D<int> bigIntMatrix(10, 10, 0);
|
|
bigIntMatrix.set(5, 5, 8);
|
|
bigIntMatrix.set(2, 3, 7);
|
|
bigIntMatrix.set(2, 2, 4);
|
|
|
|
for (int i = 0; i < bigIntMatrix.getSizeX(); i++) {
|
|
for (int j = 0; j < bigIntMatrix.getSizeY(); j++) {
|
|
cout << bigIntMatrix.at(i,j) << (j != bigIntMatrix.getSizeY() - 1 ? " : " : "");
|
|
}
|
|
cout << endl;
|
|
}
|
|
|
|
SparseMatrix2D<int> smallInMatrix(10,2,0);
|
|
cout << endl << (bigIntMatrix.compareSize(smallInMatrix) ? "True" : "False");
|
|
|
|
return 0;
|
|
}
|