The logic will allow the user to: Load a single dimensional array of size 50 with a random number The random number will range from 1 to 1,000 (you may have duplicate values) Find the highest value and the index location that it was in Find the smallest value and the index location that it was in Display the array’s contents. Display the highest value and its index location Display the lowest value and its index location Allow the user to execute this application multiple times (some sort of loop?)   You will need one for loop to load the array as well as one or two for loops to search that array.   The rand also has a “nasty” tendency to create the same results repeatedly in an exe. To avoid that, we have to “shuffle the deck” every time. This ensures that all numbers are an equal probability of appearing and not the same set of values (would create a boring game).   // Add this to "shuffle the deck" every time to ensure that // different values could occur else the exe produces the same results. srand( (unsigned)time( NULL ) );   The above has to run only one time within the source code, appearing before the rand call.   The array is used to store and retrieve values for later use in the program. What type of loop would you need?   Can you check the highest and smallest in one for loop? Output Example          Index #   89 - 97 Index #   90 - 826 Index #   91 - 310 Index #   92 - 495 Index #   93 - 750 Index #   94 - 176 Index #   95 - 175 Index #   96 - 466 Index #   97 - 611 Index #   98 - 185 Index #   99 - 325     Highest Value is 996 at Index Location # 41 Lowest Value is 5 at Index Location # 23   Run this Again (Y or N):

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

The logic will allow the user to:

  1. Load a single dimensional array of size 50 with a random number
  2. The random number will range from 1 to 1,000 (you may have duplicate values)
  3. Find the highest value and the index location that it was in
  4. Find the smallest value and the index location that it was in
  5. Display the array’s contents.
  6. Display the highest value and its index location
  7. Display the lowest value and its index location
  8. Allow the user to execute this application multiple times (some sort of loop?)

 

You will need one for loop to load the array as well as one or two for loops to search that array.

 

The rand also has a “nasty” tendency to create the same results repeatedly in an exe. To avoid that, we have to “shuffle the deck” every time. This ensures that all numbers are an equal probability of appearing and not the same set of values (would create a boring game).

 

// Add this to "shuffle the deck" every time to ensure that

// different values could occur else the exe produces the same results.

srand( (unsigned)time( NULL ) );

 

The above has to run only one time within the source code, appearing before the rand call.

 

The array is used to store and retrieve values for later use in the program. What type of loop would you need?

 

Can you check the highest and smallest in one for loop?

Output Example       

 

Index #   89 - 97

Index #   90 - 826

Index #   91 - 310

Index #   92 - 495

Index #   93 - 750

Index #   94 - 176

Index #   95 - 175

Index #   96 - 466

Index #   97 - 611

Index #   98 - 185

Index #   99 - 325

 

 

Highest Value is 996 at Index Location # 41

Lowest Value is 5 at Index Location # 23

 

Run this Again (Y or N):

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education