Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

I made a c++ code that takes inputted float txt file and stores them into an array as first part of the program. Then the program calls a function to use selection sort on the array. The program prompts the user to search for a value in the array. The program then uses binary search to find that value in the array and gives it back to the user, prompting for another value to find. So far I'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 <

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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Spatial And Temporal Databases 10th International Symposium Sstd 2007 Boston Ma Usa July 2007 Proceedings Lncs 4605

Authors: Dimitris Papadias ,Donghui Zhang ,George Kollios

2007th Edition

3540735399, 978-3540735397

More Books

Students also viewed these Databases questions

Question

Write a letter asking them to refund your $1,500 down payment.

Answered: 1 week ago