// automaticka tvorba souboru
#include<iostream>
#include<sstream>
#include<fstream>
using namespace std;
int main(void){
  int i;
  string koren("file");  // koren jmena
  string filename;   // zde bude vysledne jmeno
  ostringstream strout; // retezcovy buffer
  ofstream fw;         // souborovy buffer
  for(i = 0; i <= 9; i++){
    strout.str("");    // inicializace bufferu
    strout <<  koren << i << ".txt"; // zapis do bufferu
    filename = strout.str();  // vrati vysledne jmeno
    cout << filename << endl; // kontrolni vypis
    fw.open(filename); 
    fw << "soubor cislo " << i << endl; // zapis do souboru
    fw.close();
  } 
}

