Menu

Made C Code Takes Inputted Float Txt File Stores Array First Part Program Program Calls Fu Q43863135

I made a c++ code that takes inputted float txt file and storesthem into an array as first part of the program. Then the programcalls a function to use selection sort on the array. The programprompts the user to search for a value in the array. The programthen uses binary search to find that value in the array and givesit back to the user, prompting for another value to find. So farI’ve gotten this

//inputs an float file
int main()
{
int ARRAY_SIZE = 4; //array size is 100 max
float numbers [ARRAY_SIZE];
int count = 0; //only loop once
ifstream inputFile; //input file steam object

//Open the file
inputFile.open(“floatnumbers.txt”);

//read the numbers from the file into the array
while ( count < ARRAY_SIZE && inputFile >> numbers[count])
count++;

//close the file
inputFile.close();

/*Display the numbers read
cout << “The numbers are: *”;
for (count = 0; count < ARRAY_SIZE; count++)
cout << numbers [count] << ” “;
cout <<endl;*/

cout << “Enter a value to search for: “;
getline(cin, count);
position = binarySearch(numbers, count);
return 0;
}//end main

Expert Answer


Answer to I made a c++ code that takes inputted float txt file and stores them into an array as first part of the program. Then th…

OR