When running the code below I get the following errors. Can you please explain to me why and what I should do? I picked up the code relative to the library online but it won't work. I'm using DevC++ 5.11.
- default_random_engine is not a member of 'std'
- uniform_real_distribution is not a member of 'std'
- 'generator' was not declared in this scope
- 'distribution' was not declared in this scope
Also, how do I count time in C++?
#include <iostream>
#include <random>
int main() {
int i, j, n, nmax;
std::default_random_engine generator;
std::uniform_real_distribution<double> distribution(0.0,1.0);
nmax = 3000;
for (n=200; n<nmax; i+=200) {
double x[n], y[n], A[n][n];
for (i=0; i<n; i++) {
x[i] = distribution(generator);
y[i] = 0;
for (j=0; j<n; j++) {
A[i][j] = distribution(generator);
}
}
// start counting time
for (i=0; i<n; i++) {
for (j=0; j<n; j++) {
y[i] = A[i,j] * x[j];
}
}
// stop counting time
// total_time = stop - start
// std::cout << total_time
}
return 0;
}