Write a program that generates random numbers between 1 and 10 and fill an array of size 20 with them. Have your program sort the array then output in order the number of occurrences of each random number generated. Use the STL sort function to sort your array. How to use the STL sort: #include ... int a[20] ... sort(a,a+20); I recommend pseudo code to develop an algorithm before coding this. Example Output: This program generates random numbers and tabulates the results Original List Sorted: a[ 0] 1 a[ 1] 1 a[ 2] 1 a[ 3] 2 a[ 4] 2 a[ 5] 3 a[ 6] 6 a[ 7] 6 a[ 8] 6 a[ 9] 7 a[10] 8 a[11] 8 a[12] 8 a[13] 9 a[14] 9 a[15] 9 a[16] 9 a[17] 10 a[18] 10 a[19] 10 N Count 1: 3 2: 2 3: 1 4: 0 5: 0 6: 3 7: 1 8: 3 9: 4 10: 3 Try Again? (1 = yes, 0 = exit) 1 a[ 0] 1 a[ 1] 3 a[ 2] 3 a[ 3] 4 a[ 4] 4 a[ 5] 5 a[ 6] 5 a[ 7] 5 a[ 8] 5 a[ 9] 6 a[10] 6 a[11] 6 a[12] 8 a[13] 9 a[14] 9 a[15] 9 a[16] 9 a[17] 9 a[18] 10 a[19] 10 N Count 1: 1 2: 0 3: 2 4: 2 5: 4 6: 3 7: 0 8: 1 9: 5 10: 2 Try Again? (1 = yes, 0 = exit) 0 Press any key to continue . . .

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

Write a program that generates random numbers between 1 and 10 and fill an array of size 20 with them. Have your program sort the array then output in order the number of occurrences of each random number generated. Use the STL sort function to sort your array. How to use the STL sort: #include ... int a[20] ... sort(a,a+20); I recommend pseudo code to develop an algorithm before coding this. Example Output: This program generates random numbers and tabulates the results Original List Sorted: a[ 0] 1 a[ 1] 1 a[ 2] 1 a[ 3] 2 a[ 4] 2 a[ 5] 3 a[ 6] 6 a[ 7] 6 a[ 8] 6 a[ 9] 7 a[10] 8 a[11] 8 a[12] 8 a[13] 9 a[14] 9 a[15] 9 a[16] 9 a[17] 10 a[18] 10 a[19] 10 N Count 1: 3 2: 2 3: 1 4: 0 5: 0 6: 3 7: 1 8: 3 9: 4 10: 3 Try Again? (1 = yes, 0 = exit) 1 a[ 0] 1 a[ 1] 3 a[ 2] 3 a[ 3] 4 a[ 4] 4 a[ 5] 5 a[ 6] 5 a[ 7] 5 a[ 8] 5 a[ 9] 6 a[10] 6 a[11] 6 a[12] 8 a[13] 9 a[14] 9 a[15] 9 a[16] 9 a[17] 9 a[18] 10 a[19] 10 N Count 1: 1 2: 0 3: 2 4: 2 5: 4 6: 3 7: 0 8: 1 9: 5 10: 2 Try Again? (1 = yes, 0 = exit) 0 Press any key to continue . . .

 
Expert Solution
steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Arrays
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