Hey everyone
need some help again with finding the min and max from a text file. its my college lab assignment.
here is my code till now.
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ofstream fout;
fout.open("Text.txt");
ifstream fin;
fin.open("Lab6.txt");
float c;
int count = 0;
float sum = 0;
float mean = 0;
float min = 0;
float max = 0;
float range = 0; //<<<<<they al have to be float because the text file has float numbers>>>>
while (fin >> c)
{
count++;
sum += c;
mean = sum / count;
}
cout << "Total Amount of Numbers: " << count << endl;
cout << "Sum: " << sum << endl;
cout << "Mean: " << mean << endl;
fout << "Total Amount of Numbers: " << count << endl;
fout << "Sum: " << sum << endl;
fout << "Mean: " << mean << endl;
system("pause");
return 0;
}