Gistrec

Обратная задача 1

Sep 18th, 2019
325
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.25 KB | None | 0 0
  1. //
  2. // File: Source.cpp
  3. //
  4. #include <iostream>
  5. #include <cassert>
  6. #include <fstream>
  7. #include <vector>
  8.  
  9. using namespace std;
  10.  
  11. struct Point3d {
  12.     double x;
  13.     double y;
  14.     double z;
  15. };
  16.  
  17. struct Range {
  18.     Point3d start;
  19.     Point3d end;
  20. };
  21.  
  22.  
  23. // Приёмники
  24. vector<Range> receivers;
  25.  
  26. // Источник
  27. Range source;
  28.  
  29. const double sigma = 0.01;
  30. const double goldenI = 1;
  31. double calculatedI;
  32.  
  33. int main() {
  34.     ifstream input("example1.txt");
  35.     assert(input.is_open() && "Error while opening file");
  36.  
  37.     // Считываем источник
  38.     input >> source.start.x >> source.start.y >> source.start.z;
  39.     input >> source.end.x   >> source.end.y   >> source.end.z;
  40.  
  41.     // Считываем приёмники
  42.     while (input.good()) {
  43.         Range receiver;
  44.  
  45.         input >> receiver.start.x >> receiver.start.y >> receiver.start.z;
  46.         input >> receiver.end.x   >> receiver.end.y   >> receiver.end.z;
  47.  
  48.         receivers.emplace_back(receiver);
  49.     }
  50.  
  51.     system("pause");
  52.     return 0;
  53. }
  54.  
  55.  
  56.  
  57. // File: example1.txt
  58. //
  59. // Первая строка - координаты источника
  60. // Остальные     - координаты приёмника
  61. 0    0 0    100  0 0
  62. 200  0 0    300  0 0
  63. 500  0 0    600  0 0
  64. 1000 0 0    1100 0 0
Advertisement
Comments
  • User was banned
Add Comment
Please, Sign In to add comment