Okay I need help with this problem:
Write a function that verifies if a given number exists in an array of floats. The function is supposed to return the first position in where the number is encountered. If the given number does not exist, the function returns –1.Then write a program that asks the user to enter an array of floats and calls the function.
The prototype of the function should be like:
int Search (floats a[ ] , int n, float number)
Example:
Consider the following array of floats
2.1 1 9 -14 1.3 5.9 9 17
[0] [1] [2] [3] [4] [5] [6] [7]
If the number to be searched is 5.4 the function returns –1
If the number to be searched is 9 the function returns 2
I am having trouble with the function itself. I don't know how to print the index of the number? I just really need help with that right now. Any help would be appreciated. Thanks