#include<iostream>
usingnamespace std;
int main()
{
double value,min,max,avg,sum;
int count;
int Degree;
count=0;
min=0.0;
max=0.0;
sum=0.0;
cout<<"put your value ^_^ ,if you want stope put -1 like a value please "<<endl;
cin>>value;
while(value!=-1)//if you want stope put -1 like a value please
{
sum +=value;
count++;//for count the value
if(value>max)
max=value;
elseif((value<max)&&(value>0))// have a problem here
min=value;
cin>>value;
}
cout<<" the max value is : "<<max<<endl;
cout<<"the min value is : "<<min<<endl;
cout<<"the sum is :"<<sum<<endl;
cout<<"the count is : "<<count<<endl;
avg=sum/count;
cout<<"the avg is "<<avg<<endl;
cout<<"enter your Degree please "<<endl;
cin>>Degree;
if(Degree>=avg)
cout<<"pass"<<endl;
else
cout<<"Failed"<<endl;
system("pause");
return 0;
}
i dont know if i understood right but : elseif((value<max)&&(value>0))// have a problem here
if you want the minimum value then dont initialise min with 0. initialise it with the first value you read:(also for max)
1 2 3 4 5 6
cout<<"put your value ^_^ ,if you want stope put -1 like a value please "<<endl;
cin>>value;
//HERE
min=value;max=value;
I don't know how much skill do you have about C++ and why even can't run a code. But my code wasn't wrong. The min will be initialized with first value you input. Then next values will be tested whether is each one bigger or smaller and ...