I would like to know if I can get some help on my Programming assignment 11. I have inputed everything in Visual studio and I got one error wrong which is std::cout << std::setprecision(2); can you please help me figure out what I need to do to change this and make it correct. This is due today.
I would like to know if I can get some help on my Programming assignment 11. I have inputed everything in Visual studio and I got one error wrong which is std::cout << std::setprecision(2); can you please help me figure out what I need to do to change this and make it correct. This is due today.
using namespace std;
int calcAverage(int s1,int s2,int s3,int s4)
{
int res = s1;
if(s2<=s1 && s2<=s3 && s2<=s4) // if s2 is lowest
res = s2;
if(s3<=s1 && s3<=s2 && s3<=s4) // if s3 is lowest
res = s3;
if(s4<=s1 && s4<=s2 && s4<=s3) // if s4 is lowest
res = s4;
return res;
}
int main() {
cout<<"Enter four test cases seperated by space:"<<" ";
int s1,s2,s3,s4; // 4 type of sales..
cin>>s1>>s2>>s3>>s4; // taking input...
int x = calcAverage(s1,s2,s3,s4); /// find lowest sales
int total = s1+s2+s3+s4; // total of all sales
total -= x; // subtracting minimum amount from it;
double avg = (total*1.0)/3.0; // taking average of 3 maximum sales;
cout<<"After dropping the lowest score "<<x<<", the test average is ";
std::cout << std::fixed;
std::cout << std::setprecision(2);
cout<<avg<<"."<<endl;
}



Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images









