In an attempt to better my skills I decided to try and answer your problem. Now before I post my little work I hope that you understand that I am very new to c++, so my work is probably far from being optimized or being the 'best' solution. However, it works.

The hardest part of the code was finding a way to count the amount of digits a number had, in which the forum member Anon gave me the idea of counting the amount of times I could divide my number by 10, and it worked. So my thanks goes to Anon for solving this obstacle in my program.

The last problem is the giant size of the file created. I do not know if it is normal, and fear that it isn't, but the .txt file is 114 MB big. I find this odd but also cannot explain it. I hope that this code is still helpfull thought.

Code:
#include <iostream>
#include <cstring>
#include <fstream>

using namespace std;
 

int intnum(int oi)
{
  if (oi!=0) {
    int in = 0;
    while (oi>0) {
      in++;
      oi /= 10;
    }
    return in;
  }
  else {
    return 1;
    }
}

int main()
{
  char vs1[15]="0";
  char vs2[15]="";
  char vs3[15]="";
  int nd;
  int tn;
  int vx;

  
  ofstream nfile ( "numbers.txt" );
  for (vx=1;vx<10000000;vx++){
      strcpy(vs3,vs2);
      for(tn=(7-intnum(vx));tn>0;tn--){
                                      strcat(vs3,vs1);
                                      }                                 
  nfile<<"050"<<vs3<<vx<<"\n";
}
  nfile.close();
  cout<<"Done.";
  cin.get();
  
}
Cheers,
Smiley