Write a program that reads integers until the user types -1, then prints their average. Use a sentinel loop to accumulate sum and count, then divide. You need three variables: sum, count, and x.
Initialize sum and count to 0. Use while (cin >> x && x != -1) to read values, adding to sum and incrementing count. After the loop, check if (count == 0) to avoid division by zero.
Otherwise, calculate average = sum / (double)count; using a cast. Print with fixed and setprecision(2).