consolidate all repos to one for archive
This commit is contained in:
35
semester_2/programiranje_2/naloga0801/main.cpp
Normal file
35
semester_2/programiranje_2/naloga0801/main.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user