Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. typedef std::vector<double> reals_list;
  5.  
  6. int main()
  7. {
  8. std::vector<reals_list> list_of_lists;
  9.  
  10. list_of_lists.push_back({20.0, 20.0, 0.0});
  11. list_of_lists.push_back({36.0, 150.0, 0.0});
  12. list_of_lists.push_back({200.0, 130.0, 0.0});
  13. list_of_lists.push_back({215.0, 20.0, 0.0});
  14.  
  15. std::cout << list_of_lists[3][0]
  16. << ", " << list_of_lists[3][1]
  17. << ", " << list_of_lists[3][2] << std::endl;
  18. }
  19.  
  20. #include <iostream>
  21. #include <vector>
  22.  
  23. struct Vector3 {
  24. double x, y, z;
  25. };
  26.  
  27. int main()
  28. {
  29. std::vector<Vector3> list_of_lists;
  30.  
  31. list_of_lists.push_back({20.0, 20.0, 0.0});
  32. list_of_lists.push_back({36.0, 150.0, 0.0});
  33. list_of_lists.push_back({200.0, 130.0, 0.0});
  34. list_of_lists.push_back({215.0, 20.0, 0.0});
  35.  
  36. std::cout << list_of_lists[3].x
  37. << ", " << list_of_lists[3].y
  38. << ", " << list_of_lists[3].z << std::endl;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement