i want to generate a random array number int, this array must to have 20 dimension; i tried to get it in this way:
#include <iostream>
#include <ctime>
#include <cstdlib>
using namespace std;
int main(){
int xRan;
srand( time(0));
xRan=rand()%90+1;
int v1[20];
for(int k=0; k < 10; k++){
v1[k]= xRan;
cout <<"the random array is "<<v1[k]<<endl;
}
In this way i obtain only an int in every position of the array, how i can obtain my full position random array? thank you in advance.
Aucun commentaire:
Enregistrer un commentaire