<<< split from dead thread http://cboard.cprogramming.com/cplus...ore-while.html >>>

Can someone help me with this .cpp file ples

Code:

#include <iostream>
#include <fstream> // for file input/output
#include <vector> // for the vector container
using namespace std;
ifstream fin("text.txt"); // ifstream -> input file stream
char ch; // used to read the dots
int num; // used to read the numbers
vector<int> sums; // vector container for ints;
int counter=0; // used for .... counting
while(!fin.eof());// while we haven't
//reached the eof (end of file)
{
sums.push_back(0); // add a new element to the vector
// with initial value 0
for(int i=0;i<3;i++) // go through the three numbers
{
fin >> ch >> num; // load the dot and then the
// number
sums[counter]+=num; // add the three numbers
}
counter++; // increase the counter
}
fin.close(); // remember to close the file
// finding the mode
int frequency[500]; // 1
for(int i=0; i<500; i++)
frequency[i]=0; // 2
vector<int>::iterator it; // 3
for(it=sums.begin();it<sums.end();it++) // 4
frequency[*it-500]+=1; // 5
int mode=0; // 6
for(int h=0; h<500; h++) // 7
if(frequency[h]>mode)
mode=h;
mode+=500; //8
cout << "nmode: " << mode << "nn";
// getting the proper ascii
ofstream fout("text2.txt");
int subtract=mode-??; // subtract = the password
for(int i=0;i<sums.size();i++) // no iterators this time
{
sums[i]-=subtract; // get proper ascii numbers
cout << sums[i]; // print out message
fout << sums[i]; // save message to a text file
}
fout.close(); // close the file
return 0;
}