Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ programming language. * Write a program that uses a one-dimensional array to

ID: 3863106 • Letter: C

Question

C++ programming language.

* Write a program that uses a one-dimensional array to keep a list of integers.

* Initialize the array at runtime with random numbers.

* After the array is filled, look at each element of the array and determine the smallest value.

* Display the smallest value found and list the array element that contained that value.

This is important!!! : Please use this code to produce random numbers.

#include    // include the random library

random_device rd;   // non-deterministic generator

mt19937 gen(rd()); // to seed mersenne twister.

uniform_int_distribution<> dist(x, x);   // distribute results between x and x inclusive.

dist(gen)   // use this where you need a random number generated.

----------------------------------------------------------------------------------------------------------------

* The array should have 1000 elements of type integer.

* The random number generator should fill the elements of the array with integers between 0 and 1,000,000.

* The program should display "The smallest number found was xxx, and it was found in element xxx."

Rubric:

1. Array declaration ----    Correct   = perfect score

2. Initialization      ----    Correct = perfect score

3. Random             ----    Correctly generates random numbers = perfect score

4. Search             ----    Finds lowest and index of lowest value =   perfect score

5. Output          ----    Follows given format =   perfect score

This problem is loosely based on two of the Programming Exercises on page 602, C++ programming 7th edition, numbers 1 and 2.

* Write a program that uses a one-dimensional array to keep a list of integers.

* Initialize the array at runtime with random numbers.

* After the array is filled, look at each element of the array and determine the smallest value.

* Display the smallest value found and list the array element that contained that value.

This is important!!! : Please use this code to produce random numbers.

#include    // include the random library

random_device rd;   // non-deterministic generator

mt19937 gen(rd()); // to seed mersenne twister.

uniform_int_distribution<> dist(x, x);   // distribute results between x and x inclusive.

dist(gen)   // use this where you need a random number generated.

----------------------------------------------------------------------------------------------------------------

* The array should have 1000 elements of type integer.

* The random number generator should fill the elements of the array with integers between 0 and 1,000,000.

* The program should display "The smallest number found was xxx, and it was found in element xxx."

Rubric:

1. Array declaration ----    Correct   = perfect score

2. Initialization      ----    Correct = perfect score

3. Random             ----    Correctly generates random numbers = perfect score

4. Search             ----    Finds lowest and index of lowest value =   perfect score

5. Output          ----    Follows given format =   perfect score

Explanation / Answer

#include #include using namespace std; int main() { random_device rd; // non-deterministic generator mt19937 gen(rd()); // to seed mersenne twister. uniform_int_distribution dist(x,x); // distribute results between 1 and 6 inclusive (for distance x and x iclusive). for (int i = x; i
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote