-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFileOp.cpp
More file actions
35 lines (32 loc) · 820 Bytes
/
Copy pathFileOp.cpp
File metadata and controls
35 lines (32 loc) · 820 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# include "FileOp.h"
// A function that sets a test case file and a file pointer
void FileOp :: setFile(string &folder_name, string &s, int t, fstream &fout)
{
string tnum = numOp :: nts(t);
string f = "./" + folder_name + "/" + s + tnum;
f += ".txt";
cout << "Generating file " << f << "." << '\n';
fout.open(f, ios :: out);
}
// A function that sets precision on test case files
void FileOp :: fixOutprecision(fstream &fout)
{
fout.precision(6);
fout << fixed;
}
// A function to modify output format
int FileOp :: printT(int t)
{
int pt = 1;
if(t == 1)
{
cout << " Do you want to print number of test cases? (1 for yes, 0 for no): ";
string ss;
getline(cin, ss);
auto X = numOp :: ctnum(ss);
if(!(X.second != 0 && (X.first == 1 || X.first == 0)))
throw(111);
pt = X.first;
}
return pt;
}