Advertisement
Toxotsist

aye

Dec 7th, 2021
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <fstream>
  4. #include <sstream>
  5. #include <string>
  6. using namespace std;
  7.  
  8. struct node {
  9. int upper;
  10. int border;
  11. };
  12.  
  13. node newNode(int i, int j) {
  14. node buff;
  15. buff.upper = i;
  16. buff.border = j;
  17. return buff;
  18. }
  19.  
  20. vector <vector <node>> nodeGetter(int n, int m) {
  21. vector <vector <node>> arr(n + 1, vector <node>(m + 1));
  22. vector <node> buff(n+1);
  23. string path = "table.txt";
  24. ifstream aboba(path);
  25. string output = "";
  26. string output2 = "";
  27. for (int i = 0; i < n; i++) {
  28. for (int j = 0; j < m; j++) {
  29. getline(aboba, output, ' ');
  30. getline(aboba, output2, ';');
  31. if (output != "" && output2 != "") {
  32. cout << stoi(output) << "," << stoi(output2) << " ";
  33. }
  34.  
  35. buff.push_back(newNode(stoi(output), stoi(output2)));
  36. }
  37. cout << endl;
  38. arr.push_back(buff);
  39. buff.clear();
  40. }
  41. return arr;
  42. }
  43.  
  44. int main() {
  45. int n, m;
  46. cin >> n >> m;
  47. vector <vector <node>> arr(n+1, vector <node>(m+1));
  48. arr = nodeGetter(n, m);
  49. return 0;
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement