Skip to content

Commit 93d3f9a

Browse files
committed
Fixed the file name counter
1 parent 78e747b commit 93d3f9a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

shuffle.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <cstdlib>
55
#include <ctime>
66
#include <fstream>
7+
#include <string>
78

89
using namespace std;
910

@@ -22,8 +23,7 @@ int main()
2223
srand(time(0));
2324

2425
ofstream myfile;
25-
myfile.open ("output.csv");
26-
myfile.open("output" << filecount << ".csv");
26+
myfile.open("output" + to_string(filecount) + ".csv");
2727

2828
for(int i=0; i < NUM_SIZE; i++) //Added numbers to the vector
2929
{
@@ -51,7 +51,7 @@ int main()
5151
count = 0;
5252
filecount++;
5353
myfile.close();
54-
myfile.open("output" << filecount << ".csv"); //Open the new file
54+
myfile.open("output" + to_string(filecount) + ".csv");//Open the new file
5555
}
5656
count++;
5757
}

0 commit comments

Comments
 (0)