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):

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter6: Using Arrays
Section: Chapter Questions
Problem 10E
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.
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning