minimum

when ever i run this it will only give me the first minimum and I dont know why can someone enlighten me?


#include <iostream>

using namespace std;


int minimum(const int* values, size_t numValues)
{
int min = values[0];
int count;
for(count = 0; count < values[count]; count++)
{
if(values[count] < min)
min = values[count];
}
return min;
}



//int maximum(const int* values, size_t numValues);
//{
// int max =


int main()
{
const size_t maxValues = 10;
int values[maxValues];
int count;

cout << " Enter up to 10 integers(-1 to stop): ";
for( count=0 ; count<maxValues ; count++ )
{
cin>> values[count];
if (values[count] == -1)
break;

}
cout<< " the number you entered were:" << endl;
for( count=0 ; count<maxValues ; count++ )
{
if (values[count] == -1)
break;
cout << values[count]<< " "<<endl;
}

cout << " the minimum value is:" << minimum(values , count) <<endl;
//cout << " the maximum value is:" << maximum() << endl;
system ("pause");
return 0;

}
I'm sure this isn't what you want:

 
for(count = 0; count < values[count]; count++)

thank you
Topic archived. No new replies allowed.