-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerateServiceLibrary.cpp
More file actions
54 lines (52 loc) · 1.02 KB
/
Copy pathgenerateServiceLibrary.cpp
File metadata and controls
54 lines (52 loc) · 1.02 KB
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
#include<iostream>
#include<vector>
#include<string>
#include<fstream>
#include<cstdlib>
#include<ctime>
#include "config.cpp"
using namespace std;
int main()
{
string line;
vector <string> source;
ifstream srcfile;
ofstream destfile;
srcfile.open("source.txt");
if(srcfile.is_open())
{
while(srcfile.good())
{
getline(srcfile,line);
source.push_back(line);
}
}
srcfile.close();
destfile.open("serviceLibrary.txt",ios::out);
int word_pos; // position of the word from source
int source_size = source.size() - 1;
string annotations;
srand((unsigned)time(0));
if(destfile.is_open())
{
for(int i=0;i<no_ops;i++)
{
for(int j=0;j<ann_per_inf;j++)
{
word_pos = rand() % source_size;
annotations.append(source[word_pos]+" ");
}
annotations.append(":");
for(int j=0;j<ann_per_inf;j++)
{
word_pos = rand() % source_size;
annotations.append(source[word_pos]+" ");
}
annotations.append("\n");
destfile<<annotations;
annotations="";
}
}
destfile.close();
return 0;
}