Write a complete C++ program that reads the attached file (values.txt) to find and print the following:
a. The average value of the numbers in the file.
b. The maximum and minimum value
c. The count of negative and positive values (ignore zero)
#include <iostream>
#include<fstream>
using namespace std;
int main()
{
int count=0,poscount=0,negcount=0;
double avg,max=-9999999,min=9999999,num,sum=0;
ifstream inputFile("values.txt"); // input stream to read contents of input file
while(inputFile>>num)
{
sum=sum+num;
count++;
if (num>max)
{
max=num;
}
if (num<min)
{
min=num;
}
if (num>0)
{
poscount++;
}
if (num<0)
{
negcount++;
}
}
avg=(sum/count);
cout<<" The average value of the numbers is: "<<avg<<endl;
cout<<" The maximum number is: "<<max<<endl;
cout<<" The minimum number is: "<<min<<endl;
cout<<" There is ( "<<poscount<<" ) positive numbers "<<endl;
cout<<" There is ( "<<negcount<<" ) negative numbers "<<endl;
return 0;
}
There is errors in the program but I don't know what it is not reading the numbers from the file