the code executes normally until it reaches the part where its supposed to find the big and small numbers then it just stops but the functions seem fine to me can anyone help me out
#include<iostream>
Using namespace std;
class group
{
public:
int smallest(); // function to find the smallest element of the array
int biggest(); // function to find the biggest element of the array
int position(int); // function which returns the position of the parameter value
// (-1 if not in the array)
void assignVals(); // function which asks the user for values to put in the array
void printVals(); // function which prints the values in the array
group(); // The default constructor,
// every element of the array will be set to zero
group(int); // constructor which sets every element of the array to the parameter
private:
staticconstint SIZE = 10; // Initializes the constant SIZE to 10
int members[SIZE]; // an array of integers
};
group::group()
{
for (int i = 0; i < 10; i++)
{
members[i] = 0;
}
}
group::group(int n)
{
for (int i = 0; i < 10; i++)
{
members[i] = n;
}
}
void group::printVals()
{
cout << "The numbers you entered are : ";
for (int i = 0; i < 10; i++)
{
cout << members[i] << " ";
}
}
void group::assignVals()
{
for (int i = 0; i < 10; i++)
{
cout << "Enter a number :";
cin >> members[i];
}
}
int group::position(int n)
{
int pos;
for (int i = 0; i < 10; i++)
{
if (members[i] == n)
return i;
else
pos = -1;
}
return pos;
}
int group::smallest()
{
int small;
small = members[0];
for (int i = 0; 1 < 10; i++)
{
if (small < members[i])
small = members[i];
}
return small;
}
int group::biggest()
{
int big;
big = members[0];
for (int i = 0; 1 < 10; i++)
{
if (big < members[i])
big = members[i];
}
return big;
}
int main()
{
int num, pos;
group numbers;
group numbers2(5);
numbers.printVals();
cout << endl;
numbers2.printVals();
cout << endl;
numbers.assignVals();
cout << "Now for the next group" << endl;
cout << "______________________" << endl;
numbers2.assignVals();
cout << "What number are you looking for? ";
cin >> num;
pos = numbers.position(num);
if (pos == -1)
cout << "The number " << num << " is not in the first group\n";
else
cout << "The number " << num << " is at position " << pos << " of the first group\n";
pos = numbers2.position(num);
if (pos == -1)
cout << "The number " << num << " is not in the second group\n";
else
cout << "The number " << num << " is at position " << pos << " of the second group";
cout << "The smallest value in the group is: " << numbers.smallest() << endl;
cout << "The largest value in the group is: " << numbers.biggest() << endl;
cout << "The smallest value in the second group is: " << numbers2.smallest() << endl;
cout << "The largest value in the second group is: " << numbers2.biggest() << endl;
return 0;
}