-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtransfer.cpp
More file actions
41 lines (38 loc) · 1009 Bytes
/
Copy pathtransfer.cpp
File metadata and controls
41 lines (38 loc) · 1009 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
36
37
38
39
40
41
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <sstream>
#include "transfer.h"
using namespace std;
vector<string> split(string str, char delimiter) {
vector<string> internal;
stringstream ss(str); // Turn the string into a stream.
string tok;
while(getline(ss, tok, delimiter)) {
internal.push_back(tok);
}
return internal;
}
vector<double>* trans(string p1,string p2,string p3){
vector<string> s1=split(p1,' ');
vector<string> s2=split(p2,' ');
vector<string> s3=split(p3,' ');
vector<double> *n_set=new vector<double>[3];
int i=atoi(s1[0].c_str());
for (;i>0;i--){
int value = atoi(s1[i].c_str());
n_set[0].push_back(value);
}
i=atoi(s2[0].c_str());
for (;i>0;i--){
int value = atoi(s2[i].c_str());
n_set[1].push_back(value);
}
i=atoi(s3[0].c_str());
for (;i>0;i--){
int value = atoi(s3[i].c_str());
n_set[2].push_back(value);
}
return n_set;
}