Creating file names automatically C++

前端 未结 5 1389
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-04 18:41

I\'m trying to write a program in C++, which creates some files (.txt) and writes down the result in them. The problem is that an amount of these files is not fixed at the begin

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-04 19:14

    Sample code:

    #include 
    #include 
    #include 
    #include 
    using namespace std;
    
    string IntToStr(int n) 
    {
        stringstream result;
        result << n;
        return result.str();
    }
    
    int main () 
    {
        ofstream outFile;
        int Number_of_files=20;
        string filename;
    
    
      for (int i=0;i

提交回复
热议问题