Design an application that creates a file named numbers.txt populated with 100 random integers 1-100. The program should

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Design an application that creates a file named numbers.txt populated with 100 random integers 1-100. The program should

Post by answerhappygod »

Design An Application That Creates A File Named Numbers Txt Populated With 100 Random Integers 1 100 The Program Should 1
Design An Application That Creates A File Named Numbers Txt Populated With 100 Random Integers 1 100 The Program Should 1 (40.1 KiB) Viewed 57 times
Design an application that creates a file named numbers.txt populated with 100 random integers 1-100. The program should read and assign all the numbers stored in numbers.txt to an array. Next the program should call a function that uses the selection sort algorithm to sort the array. Then the program should call another function that uses the binary search algorithm to locate a value in the array. It should also keep a count of the number of comparisons it makes. Sample program run #1 with input shown in bold: Enter number to find (1-100): 86 For binary search, number of comparisons: 100 Search failed. Sample program run #2 with input shown in bold: Enter number to find (1-100): 86 For binary search, number of comparisons: 90 Number is found at position: 89 Sample program run #3 with input shown in bold: Enter number to find (1-100): 29 For binary search, number of comparisons: 33 Number is found at position: 32 Sample program run #4 with input shown in bold: Enter number to find (1-100): 29 For binary search, number of comparisons: 26 Number is found at position: 25
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply