I'm trying to find the lowest number in the array but cant seem to finish the function in the main...could some help please
Code:
#include<iostream> int FindLowNum(int [], int ); int main() { const int arraySize = 20; int a[ arraySize ] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 }; int total = 0; // sum contents of array a for ( int i = 0; i < arraySize; i++ ) total += a[ i ]; cout << "Total of array element values is " << total << endl; int FindLowNum(int a, int size); cout << "the lowest value is :\n"<< a; return 0; // indicates successful termination } int FindLowNum(int array[], int size) { int lowest_so_far = array[0]; for (int i=1; i<size; i++) { if (array[i]<lowest_so_far) lowest_so_far = array[i]; } return lowest_so_far; }
Comment