In my homework they ask for any large vector in 2 dimensions. I need to implement multiplication operation.
Code:
#include <iostream>
#include <vector>
using namespace std;
class TDVect {
private:
unsigned int row;
unsigned int column;
double TDvect[row][column];
public:
TDVect(unsigned int A, unsigned int B) {
row = A;
column = B;
}
unsigned int getLength() { //to do: parameterize, return number of row or columns
return row;
}
unsigned int getWidth() {
return column;
}
double getElement(unsigned int i, unsigned int j) {
return TDVect[i][j];
}
void setElement(unsigned int i, unsigned int j, double x) {
TDVect[i][j] = x;
}
};
class V:public TDVect {
V():TDVect(1, 2) {
}};
class M:public TDVect {
M():TDVect(2, 2) {
}};
V multiplication(V F, M G)
{ //to do: row times column
V vmid();
vmid.setElement(0, 0, F[0][0] * G[0][0] + F[0][1] * G[1][0]);
vmid.setElement(0, 1, F[0][0] * G[0][1] + F[0][1] * G[1][1]);
return vmid;
}
int main()
{
TDVect vectobjA(-1, +9); //expected error; not given
cout << vectobjA.getLength() << " ";
return 0;
}
I'm getting quite a few errors in VScode :
E0245,EO254,E0040,E0028.
I guess the errors are related to each other but I dont understand them.
We did't have STD::Vector in the lectures.