Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- #include <vector>
- #include <algorithm>
- using namespace std;
- char *filename(int len1, int len2) //returns name for the output file: res_<first sequence length>_<second sequence length>.csv
- {
- char *ans = new char[16];
- strcpy(ans, "res_");
- vector<int> num;
- while (len1 > 0)
- {
- num.push_back(len1%10);
- len1 /= 10;
- }
- reverse(num.begin(), num.end());
- for (int x: num)
- {
- char *s3 = new char;
- *s3 = (char) ((int) '0' + x);
- strcat(ans, s3);
- }
- strcat(ans, "_");
- num.clear();
- while (len2 > 0)
- {
- num.push_back(len2%10);
- len2 /= 10;
- }
- reverse(num.begin(), num.end());
- for (int x: num)
- {
- char *s3 = new char;
- *s3 = (char) ((int) '0' + x);
- strcat(ans, s3);
- }
- strcat(ans, ".csv");
- return ans;
- }
- int main()
- {
- for (int i = 1; i < 5; i++)
- for (int j = 1; j < 7; j++)
- cout << filename(i, j) << "\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement