-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCSV.cpp
74 lines (67 loc) · 1.48 KB
/
CSV.cpp
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#include "../include/CSV.h"
#include <fstream>
#include <random>
#define COUT std::cout
#define ENDL std::endl
#define CIN std::cin
int main(){
std::fstream thefile;
long unsigned int numCols;
double lower;
double upper;
std::string fileName;
COUT << "Enter the file name: ";
CIN >> fileName;
COUT << ENDL;
numCols = 10;
thefile.open(fileName);
for(int j = 0; j < 8; ++j){
lower = 6500;
upper = 10000;
for(unsigned int i = 0; i < numCols; ++i){
double val;
val = ((double)rand() / RAND_MAX) * (upper - lower) +lower;
thefile << val << ",";
}
thefile << "\n";
}
for(int j = 0; j<8; ++j){
lower = 270;
upper = 650;
for(unsigned int i = 0; i < numCols; ++i){
double val;
val = ((double)rand() / RAND_MAX) * (upper - lower) +lower;
thefile << val << ",";
}
thefile << "\n";
}
for (int j = 0; j<8; ++j){
lower = 234;
upper = 334;
for(unsigned int i = 0; i < numCols; ++i){
double val;
val = ((double)rand() / RAND_MAX) * (upper - lower) +lower;
thefile << val << ",";
}
thefile << "\n";
}
for (int j = 0; j<8; ++j){
lower = 6.4;
upper = 7.4;
for(unsigned int i = 0; i < numCols; ++i){
double val;
val = ((double)rand() / RAND_MAX) * (upper - lower) +lower;
thefile << val << ",";
}
thefile << "\n";
}
lower = 5;
upper = 100;
for(unsigned int i = 0; i < numCols; ++i){
double val;
val = ((double)rand() / RAND_MAX) * (upper - lower) +lower;
thefile << val << ",";
}
thefile << "\n";
thefile.close();
}