You still haven't initalized
temp2.
By the way, here's what I think it should look like:
temp2 = -99;
while (number != SENTINEL)
{ // open while 3
counter++;
cin >> number;
if (number == -99) {
break;
}
if (number < temp2 || temp2 == -99)
temp2 = number;
}
Probably not the best way of doing it, but it works.
"Technological progress is like an axe in the hands of a pathological criminal."
All my posts may be freely redistributed under the terms of the MIT license.