I have the following code:
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, cases = 1, a[3];
cin >> n;
while(cases != n + 1)
{
cin >> a[0] >> a[1] >> a[2];
sort(a, a + 2);
cout << "Sorted array: " << a[0] << " " << a[1] << " " << a[2] << endl;
cout << "Case " << cases << ": " << a[1] << endl;
cases++;
}
return 0;
}
For cases with entries: 30 25 15, the array is: 25 30 15.
Would this be a bug, or was it implemented wrongly?