Hello I am tring to write a code to generate random numbers into an array, I don't understand why this isn't working. please help
#include <iostream>
#include <ctime>
#include <cstdlib>
const int NRows = 5;
const int Ncols = 5;
using namespace std;
int main()
{
//declare variables
int num[NRows][Ncols]; // my matrix
int temp; //tempoary spot for random numbers
//seed random number generator
srand(time(0));
//introduce program
cout << "this program will generate a matrix of random number between 0 and 10!" << endl;
//generate random numbers and input into matrix
for(int i=0; i<NRows; i++)
{
for(int j=0; j<Ncols; j++)
{
temp = rand()%10;
temp >> num[i][j];
}
}
//display the array
for(int i=0; i<NRows; i++)
{
for(int j=0; j<Ncols; j++)
{
cout << num [i][j] << ' ';
cout << endl;
}
}
return(0);
}