Dear Experts,
from the example given below, I would like to Generate a matrix who stores a generated array for each iteration. I have an understanding of inputting single elements to a matrix but how can I input an array to a matrix. let's say I would like to input and array of 4 elements that should be stored as a single row of the generated matrix and do this for an infinite while{true} loop.
#include <iostream>
#include <unistd.h>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <stdlib.h>
#include <stdio.h>
#include <vector>
void printArray(int arr[], int size) {
for ( int i = 0; i < size; i++ ) {
cout << arr[i] << ' ';
}
cout << endl;
}
int main(){
srand(time(NULL));
int c1= (rand()%10)+4;
int c2= (rand()%10)+4;
int c3= (rand()%10)+4;
int c4= (rand()%10)+4;
cout <<"Generated Values are:"<<c1 <<","<<c2<<","<<c3<<","<<c4<<endl;
std::cout <<endl<< "put these value into an array" << std::endl;
int arr[]{c1,c2,c3,c4};
int size=sizeof(arr)/sizeof(arr[0]);
printArray(arr,size);
std::cout <<endl<< "Let's creat a matrix now" << std::endl;
std::vector<int>::iterator itr; // to display matrix elements
vector<vector<double> >matrix;
}