Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <fstream>
- #include <sstream>
- #include <string>
- using namespace std;
- struct node {
- int upper;
- int border;
- };
- node newNode(int i, int j) {
- node buff;
- buff.upper = i;
- buff.border = j;
- return buff;
- }
- vector <vector <node>> nodeGetter(int n, int m) {
- vector <vector <node>> arr(n + 1, vector <node>(m + 1));
- vector <node> buff(n+1);
- string path = "table.txt";
- ifstream aboba(path);
- string output = "";
- string output2 = "";
- for (int i = 0; i < n; i++) {
- for (int j = 0; j < m; j++) {
- getline(aboba, output, ' ');
- getline(aboba, output2, ';');
- if (output != "" && output2 != "") {
- cout << stoi(output) << "," << stoi(output2) << " ";
- }
- buff.push_back(newNode(stoi(output), stoi(output2)));
- }
- cout << endl;
- arr.push_back(buff);
- buff.clear();
- }
- return arr;
- }
- int main() {
- int n, m;
- cin >> n >> m;
- vector <vector <node>> arr(n+1, vector <node>(m+1));
- arr = nodeGetter(n, m);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement