Ok well i got the function to work, the basic concept is the same there were just same design flaws in it... i don't like it at all though, it is way to long for a function and it is messy at hell but look at the bright side, it works
Code:
void copy ( ifstream& input_file , ofstream& output_file )
{
char symbol = '\0';
char Buffer = '\0';
char Buffer2 = '\0';
int sum, count;
double average ;
input_file.get(symbol);
while ( ! input_file.eof() )
{
while ( ! isdigit(symbol) )
{
output_file.put(symbol);
input_file.get(symbol);
}
sum=0;
count=0;
while(symbol != '\n' && !input_file.eof())
{
if( symbol == ' ' )
count = count + 1;
else if(isdigit(symbol))
{
input_file.get(Buffer);
if(isdigit(Buffer))
{
if( symbol == '1' && Buffer == '0' )
{
input_file.get(Buffer2);
if(Buffer2 == '0')
{
sum = sum + 100;
output_file.put('1');
output_file.put('0');
output_file.put('0');
}
else
{
sum = sum + 10;
output_file.put('1');
output_file.put('0');
count = count + 1;
}
}
else
{
sum = sum + ( ( (int)symbol - 48 ) * 10 ) + ( (int)Buffer - 48 );
output_file.put(symbol);
output_file.put(Buffer);
}
}
else
{
sum = sum + ( (int)symbol - 48 );
count = count + 1;
output_file.put(symbol);
}
}
else
break;
output_file.put(' ');
input_file.get(symbol);
}
output_file<< " (** sum= "<< sum << ", count: " << count ;
output_file.setf(ios::fixed);
output_file.setf(ios::showpoint);
output_file.precision(2);
average = (double)sum / (double)count ;
output_file << ", average: "<< sum << " / " << count << " = " << average << " **) ";
output_file.put('\n');
sum = 0;
count = 0;
}
}