Another project on arrays. I need to get the smallest number in an array. Enclosed is code. Your input highly needed!
#include<iostream>
using namespace std;
int smallestnumberindex(const int number[int index])
int main()
{
int number[10];
int index;
int smallestnumber;
//initialize the array
for (index = 0; index < 10; index++)
number[index] = 0;
//input data
cout << "Enter 10 integers " << endl;
for (index = 0; index < 10; index++)
cin >> number[index];
// print array
for (index = 0; index < 10; index++)
cout << number[index] << " ";
cout << "The smallest index is " << smallestnumberindex << endl;
}
int smallestnumberindex(const int number[index])
int smallestnumberindex = 0;
int index;
for (index = 1; index < 10; index++)
{
if number[smallestnumberindex] < number[index]
smallestnumberindex = index;
return = smallestnumberindex;
}
return 0;
}