Code:
char numname[256];
char outputname[256];
for(i=0;i<100;i++)
{
sprintf(numname,"im%03d", i);
cout << "numname : " << numname << endl;
sprintf(outputname,"%s.png", numname);
cout << "outputname : " << outputname << endl;
}
I prefer to use sprintf as you can format the string better, eg :
sprintf(numname,"im%03d",i);
will give the output as :
numname : im000
outputname : im000.png
numname : im001
outputname : im001.png
...
numname : im099
outputname : im099.png
At least all the names will have the same length then.