Question: C++ Create a program that will read values from a file called Lab8.dat (posted on Canvas) and store it into an array using a function

C++

Create a program that will read values from a file called Lab8.dat (posted on Canvas) and store it into an array using a function other than main. The number of values in the file is less than 300 and all the values are whole numbers. The actual number of values stored in the file should be returned to the function call. Your program should contain another function that accepts the array, the number of values in the array, and a whole number. This function should use a loop to count how many values in the array are evenly divisible by the whole number and return this count to the function call. The loop should not contain more than 3 arithmetic operators (++ and += count as arithmetic operators, but = does not). The main function should call the function to read the data from the file. Next, ask the user to enter a whole number between 2 and 20 (you may assume the user enters a correct value). This whole number is the value to divide each element in the array. Next, call the function to determine how many values in the file are evenly divisible by the entered whole number and output the returned count. The message should be something like 35 of the 189 values in the file were evenly divisible by 19. with the underlined values replaced by the your calculated values and the users input

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!