-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgeneratedata.cpp
More file actions
33 lines (28 loc) · 778 Bytes
/
Copy pathgeneratedata.cpp
File metadata and controls
33 lines (28 loc) · 778 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
#include <bits/stdc++.h>
double distanceBetweenTwoPoints(double x, double y, double a, double b){
using namespace std;
return sqrt(pow(x - a, 2) + pow(y - b, 2));
}
int main() {
using namespace std;
int s = 100;
freopen("coord100.txt","w+",stdout);
vector<pair<int, int> > coord;
while(s--){
int x = rand()%2000;
int y = rand()%2000;
int asc = rand()%26 + 97;
char n = asc;
cout<<n<<" "<<x<<" "<<y<<endl;
coord.push_back(make_pair(x,y));
}
freopen("transition100.txt","w+",stdout);
for(int i =0 ; i < 100; i++) {
for(int j =0 ; j < 100; j++) {
printf("%4.4f",distanceBetweenTwoPoints(coord[i].first,coord[i].second, coord[j].first,coord[j].second));
if (j != 99)cout<<'\t';
}
cout<<endl;
}
return 0;
}