I keep getting a erroe saying assertion debug failed. Why doesn't this give me the max and min, etc..?
When I enter name of input file: test1.dat
with data such as
and when it says the name of the ouput file: test1.out. I press enter and the error poops (I mean pops) up. Strange! Can anyone please explain why?
It should read something like 5 values ranging from 11 to 15 and its average.
BTW here is my code:
using namespace std;
cout << "This program computes the number, maximum, minimum, and\n"
"average of an input list of numbers in one file,\n"
"and places its results in another file.\n\n";
// input section
cout << "Enter the name of the input file: ";
int count = 0;
maximum = DBL_MIN,
minimum = DBL_MAX,
sum = 0.0;
inStream >> reading;
sum += reading;
if (reading < minimum)
minimum = reading;
if (reading > minimum)
maximum = reading;
// output section
cout << "Enter the name of the oputput file: ";
outStream << "\n--> There were " << count << " values.";
if (count > 0)
outStream << "\n\tranging from " << minimum
<< " to " << maximum
<< "\n\tand their average is " << sum / count
cout << "Processing complete.\n";