Ok so Im suppose to make this program were the user inputs the size of the array then the user sets a certain range min and max for random numbers to be generated. I have a function named fillarray()
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int fillarray();
int main()
{
system ("CLS");
int size, i;
cout << "Please input the size of the array you want to examine ==> ";
cin >> size;
double* a = new double [size];
for(i = 0; i < (size + 1); i++)
{
if(i == 0)
a[i] = size;
else
a[i] = fillarray();
}
cout << "\t\t\t\t\t ";
system ("PAUSE");
system ("CLS");
}
int fillarray()
{
int srand((unsigned)time(0));
int lowest;
int highest;
int random_integer = 0;
cout << "Please input your minimum range ==> ";
cin >> lowest;
cout << "Please input your maximum range ==> ";
cin >> highest;
for(int i = 0; i < 50; i++)
{
random_integer = (rand()%highest + lowest);
}
return random_integer;
}
whenever i run the program i keep on getting a loop for the size of the array
any help with this code?