Answer:
Following are the code to this question:
#include <iostream>//defining header file
#include <cstdlib>//defining header file
using namespace std;
int main()//defining main method
{
const int ax[10]={1,2,3,4,5,6,7,8,9,10};//defining a const array ax that store 10 numbers
int r_num[10];//defining an array r_num
int i;//defining integer variable
for(i=0;i<10;i++)//defining for loop to calculate and store random numbers in array
{
r_num[i]=rand()%100; //use rand function to store value in array
}
cout<<"Elements of the array that stores 10 random numbers: "<<endl;//print message
for(i=0;i<10;i++)//defining for loop for print array value
{
cout<<r_num[i]<<endl;//print array value
}
return 0;
}
Output:
Elements of the array that stores 10 random numbers:
83
86
77
15
93
35
86
92
49
21
Explanation:
In the above-given program, two arrays "ax, and r_num" is declared that store value in it, in which the ax array use the const keyword and in the r_num it uses the loop and random function which can be defined as follows:
In the second array "r_num", two for loop is declared, in which the first loop uses the rand function to store value in the array, and in the second array, it prints the value of the array.