keep track of last user number issued. Increment by one for each new one issued. Store user number as a string using itoa() or sprintf() or strstream or whatever. Determine string length. If length 1 append two zero's. If length is two append 1 zero.
There are many ways to shrink a string. One way is to copy the contents of the original string into a second one, char by char, until you find the char you want to use as a terminating char.
int lastUserNumber = 0;
char continue = 'y';
char twoZeros = "00";
char oneZero = "0";
//new user number
currentUserNumber = ++lastUserNumber;
sprintf(sUserNumber, "%d", currentUserNumber);//or whatever
length = strlen(sUserNumber);
if(length == 1)
else if (length == 2)
//similar for length == 2
//then do something with sUserNumber
cout << "this user number is" << sUserNumber << endl;
cout << "to stop enter any key but lower case y" << endl;
cin >> continue;
cout << "enter a filename with extension: xxxxxx.xxx"
cin >> input;
//copy input into filename until you find a period.
for(i = 0; i < strlen(input); ++i)
if(input[i] = '.')
filename[i] = '\0';
filename[i] = input[i];