i tried this
#include <fstream>
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
// Declare input stream
ifstream fin;
int min, max, val;
int isFirst = true;
fin.open("inFile.txt");
fin >> isFirst;
min = isFirst;
max = isFirst;
while (fin >> val)
{
fin >> val;
if (val < min)
val = min;
else
val = max;
}
fin.close();
cout << "Largest value is " << max << ", smallest value is " << min << "\n";
return 0;
}
and it prints this
Largest value is 1, smallest value is 1
Press any key to continue
can someone suggest me what's i am doing wrong here