Hi all, I`m very new to C++ and I have a homework from my c++ teacher.
A part of my homework is to make a 5x5 matrix and to show it on the screen.
Another part is to make a code which generates random numbers from 1 to 9.
Can someone help me with at least the first part?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#include <vector>
using std::vector;
#define HEIGHT 5
#define WIDTH 5
int main() {
vector<vector<double> > Matrix;
// Set up sizes. (HEIGHT x WIDTH)
Matrix.resize(HEIGHT);
for (int i = 0; i < HEIGHT; ++i)
Matrix[i].resize(WIDTH);
// I need something to fill the matrix with random numbers from 1 to 9
return 0;
}