Objectives: Demonstrate the ability to create and use arrays. • Demonstrate the ability to search an array using a sequential search. • Demonstrate the ability to use sound programming practices. • Demonstrate the use of a function and pointers. Demonstrate the ability to use the Linux server. Problem Description: You are tasked with creating a program that will create an array of 100 random integers in the range of 1 to 200 (inclusive) once. Your array may contain duplicate values. Your program will then randomly generate a search target/value in the same range of 1 to 200 and perform a sequential search on the array of stored random values 100 times. Your program should print out the following statistics: The number of successful searches (a match was found). The number of failed searches. (no match was found in the array) The average number of tests (test comparisons) per search*. If a match is found at index 50 then 51 tests were done for that search. If no match was found then all 100 elements were tested. total comparisons/100 searches = average number of tests per search. During a search of the array each item will be tested if it is a match, you must keep count of how many tests are performed for each search to compute the average number of tests per search. Summary, your program should load an array with 100 numbers from 1 to 200 and then randomly generate a search term and search it 100 times (with 100 different search terms) while keeping track of statistics.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter7: Arrays
Section: Chapter Questions
Problem 2PP: (Practice) Define an array named peopleTypes that can store a maximum of 50 integer valuesentered at...
icon
Related questions
Question

In C language please;

Requirements:

  • You must use the correct program and function descriptions. 
  • You must use a user defined function for the sequential search and it must use pointers to keep track of the number of successful searches as well as how many test comparisons were made.
  • You must use the srand() function and offset and range correctly. 
Objectives:
Demonstrate the ability to create and use arrays.
• Demonstrate the ability to search an array using a sequential search.
Demonstrate the ability to use sound programming practices.
• Demonstrate the use of a function and pointers.
Demonstrate the ability to use the Linux server.
Problem Description:
You are tasked with creating a program that will create an array of 100 random integers in the range of 1
to 200 (inclusive) once. Your array may contain duplicate values. Your program will then randomly
generate a search target/value in the same range of 1 to 200 and perform a sequential search on the
array of stored random values 100 times. Your program should print out the following statistics:
The number of successful searches (a match was found).
The number of failed searches. (no match was found in the array)
The average number of tests (test comparisons) per search*. If a match is found at index 50 then 51
tests were done for that search. If no match was found then all 100 elements were tested. total
comparisons / 100 searches = average number of tests per search.
During a search of the array each item will be tested if it is a match, you must keep count of how many
tests are performed for each search to compute the average number of tests per search.
Summary, your program should load an array with 100 numbers from 1 to 200 and then randomly
generate a search term and search it 100 times (with 100 different search terms) while keeping track of
statistics.
Transcribed Image Text:Objectives: Demonstrate the ability to create and use arrays. • Demonstrate the ability to search an array using a sequential search. Demonstrate the ability to use sound programming practices. • Demonstrate the use of a function and pointers. Demonstrate the ability to use the Linux server. Problem Description: You are tasked with creating a program that will create an array of 100 random integers in the range of 1 to 200 (inclusive) once. Your array may contain duplicate values. Your program will then randomly generate a search target/value in the same range of 1 to 200 and perform a sequential search on the array of stored random values 100 times. Your program should print out the following statistics: The number of successful searches (a match was found). The number of failed searches. (no match was found in the array) The average number of tests (test comparisons) per search*. If a match is found at index 50 then 51 tests were done for that search. If no match was found then all 100 elements were tested. total comparisons / 100 searches = average number of tests per search. During a search of the array each item will be tested if it is a match, you must keep count of how many tests are performed for each search to compute the average number of tests per search. Summary, your program should load an array with 100 numbers from 1 to 200 and then randomly generate a search term and search it 100 times (with 100 different search terms) while keeping track of statistics.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 4 images

Blurred answer
Knowledge Booster
Concept of pointer parameter
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
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
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
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage