(Solved) : Write Main Function Declares Names Marks Number Elements Well Value Searched Index Returne Q42726202 . . .

c++
Write a main function that declares the names, marks, number of elements as well as the value to be searched for and the indeWrite a main function that declares the names, marks, number of elements as well as the value to be searched for and the index of the returned function calls. Read and display the contents of names and marks. Ask the user for a name and using the linear search return the index to the user. If -1 is returned then the name is not in the file. Otherwise write out the name and mark for that student. Sort the arrays and write them out. Ask the user for a name to search for. This time use the binary Search to retum-1 or an index. Display the student’s name and mark if found. Test your program for found and not found for each type of search. void getNames(string names[], int marks[], int& numElts); int linear Search(const string names[], int numElts,string who); int binary Search(const string names[], int numElts,string who); void selectionSort(string names[], int marks[], int numElts); void displayData(const string names(), const int marks[], int numElts): const int NUM Names = 20; int main() string names[NUM NAMES); int marks[NUM NAMES): int numElts; int index; string search Who; // Function calls here return 0; File for names and marks: Collins, Bill 80 Smith, Bart 75 Allen, Jim 82 Griffin, Jim 55 Stamey, Marty 90 Rose, Geri 78 Taylor, Terri 56 Johnson, Jill 77 Allison, Jeft 45 Looney, Joe 89 Wolfe, Bill 63 James, Jean 72 Weaver, Jim 77 Pore, Bob 91 Rutherford, Greg 42 Javens, Renee 74 Harrison, Rose 58 Setzer, Cathy 93 Pike, Gordon 48 Holland, Beth 79 Show transcribed image text Write a main function that declares the names, marks, number of elements as well as the value to be searched for and the index of the returned function calls. Read and display the contents of names and marks. Ask the user for a name and using the linear search return the index to the user. If -1 is returned then the name is not in the file. Otherwise write out the name and mark for that student. Sort the arrays and write them out. Ask the user for a name to search for. This time use the binary Search to retum-1 or an index. Display the student’s name and mark if found. Test your program for found and not found for each type of search. void getNames(string names[], int marks[], int& numElts); int linear Search(const string names[], int numElts,string who); int binary Search(const string names[], int numElts,string who); void selectionSort(string names[], int marks[], int numElts); void displayData(const string names(), const int marks[], int numElts): const int NUM Names = 20; int main() string names[NUM NAMES); int marks[NUM NAMES): int numElts; int index; string search Who; // Function calls here return 0; File for names and marks: Collins, Bill 80 Smith, Bart 75 Allen, Jim 82 Griffin, Jim 55 Stamey, Marty 90 Rose, Geri 78 Taylor, Terri 56 Johnson, Jill 77 Allison, Jeft 45 Looney, Joe 89 Wolfe, Bill 63 James, Jean 72 Weaver, Jim 77 Pore, Bob 91 Rutherford, Greg 42 Javens, Renee 74 Harrison, Rose 58 Setzer, Cathy 93 Pike, Gordon 48 Holland, Beth 79

Expert Answer


Answer to Write a main function that declares the names, marks, number of elements as well as the value to be searched for and the…

Leave a Comment

About

We are the best freelance writing portal. Looking for online writing, editing or proofreading jobs? We have plenty of writing assignments to handle.

Quick Links

Browse Solutions

Place Order

About Us

× How can I help you?