hey!
so i have to write a code that generates a number from 25-100 (x) and this will be the index of my array. i then need to x numbers from 1-1000 and store them as the element of my array. that is the first function. in the second function i need to write a code that returns the location of the smallest element, in the third function i need to write a code that returns the location of the largest element and in the last function i need to print the largest and smallest number. this is what i have right now..and am stuck. Someone plss help me!!

``````#include <iostream>
#include <ctime>
#include <cstdlib>

using namespace std;
int num2;
int loadArray (int);
int smallestLocation (int);
int largestLocation (int);
void printSmallestLargest (int);
int main ()
{
int max = 0;
int number = 0;
loadArray(max);
return 0;
}

int loadArray (int maximumNumber[])
{
srand(time(0));
int maxNumber;
maxNumber =  rand()%76 + 25 ;
maximumNumber[maxNumber];
for(int i = 0; i<=maxNumber; i++)
{
int values =  rand()%1000 + 1 ;
for(int j = 0; j<=maxNumber; j++)
{
maximumNumber  = j;
return maxNumber;
}
}
}

int smallestLocation (int small[])
{
``````

## Recommended Answers

Let me see if I understand.
The first number is a RANDOM number between 25-100.
That number will be used to create THAT NUMBER of random numbers between 1-1000.

Then you need the index of the smallest number
Then you need the index of the largest number
Then you …

## All 2 Replies

Let me see if I understand.
The first number is a RANDOM number between 25-100.
That number will be used to create THAT NUMBER of random numbers between 1-1000.

Then you need the index of the smallest number
Then you need the index of the largest number
Then you need to print the value of the smallest and the value of the largest.

Is that right?

Does what you have work? That's your first step. Don't try writing the whole thing at once.

Get `LoadArray()` working well first. Output the entire array at the end of `main()` And use CODE tags.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.