Write a program that accepts an indefinite set of numbers until the user enters “-1”. In other words, the program keeps accepting new values until the user provides a “-1” (your program accepts all values, and discards the “-1”). When done, the program prints back to the user: (i) the sum of all numbers entered (except -1), (ii) the minimum value seen across all numbers (except -1), and (iii) the maximum value across all numbers (except -1). The language is C++
#include <iostream>
using namespace std;
int main()
{
int min,max,sum=0,num,flag=1;
cout<<"Enter numbers (-1 to quit): ";
while(true){
cin>>num;
//break if user gives -1
if(num==-1)
break;
// for the first time
// assuming first num as min and max
if(flag){
flag=0;
min=num;
max=num;
}
else{
if(num<min)
min=num;
if(num>max)
max=num;
}
sum+=num;
}
cout<<"Sum : "<<sum<<endl;
cout<<"Min : "<<min<<endl;
cout<<"Max : "<<max<<endl;
return 0;
}

Note : Please comment below if you have concerns. I am here to help you
If you like my answer please rate and help me it is very Imp for me
Write a program that accepts an indefinite set of numbers until the user enters “-1”. In...