This program asks for 100 inputs and sorts inputs in ascending order also calculates the average of all the inputs. I am wondering how do i make it to exit upon entering negative number instead of asking for 100 inputs, and show average .
solved!
Try This In Your Code in for loop
cin >> temp;
if(temp >= 0)
anArray[count] = temp;
else
{
scores = count;
break;
}