int i;
char str[256];
for(int i=1; i<=3; i++){
  sprintf(str,"./a.exe < %d.txt",i);
  system(str);
}