Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // File: Source.cpp
- //
- #include <iostream>
- #include <cassert>
- #include <fstream>
- #include <vector>
- using namespace std;
- struct Point3d {
- double x;
- double y;
- double z;
- };
- struct Range {
- Point3d start;
- Point3d end;
- };
- // Приёмники
- vector<Range> receivers;
- // Источник
- Range source;
- const double sigma = 0.01;
- const double goldenI = 1;
- double calculatedI;
- int main() {
- ifstream input("example1.txt");
- assert(input.is_open() && "Error while opening file");
- // Считываем источник
- input >> source.start.x >> source.start.y >> source.start.z;
- input >> source.end.x >> source.end.y >> source.end.z;
- // Считываем приёмники
- while (input.good()) {
- Range receiver;
- input >> receiver.start.x >> receiver.start.y >> receiver.start.z;
- input >> receiver.end.x >> receiver.end.y >> receiver.end.z;
- receivers.emplace_back(receiver);
- }
- system("pause");
- return 0;
- }
- // File: example1.txt
- //
- // Первая строка - координаты источника
- // Остальные - координаты приёмника
- 0 0 0 100 0 0
- 200 0 0 300 0 0
- 500 0 0 600 0 0
- 1000 0 0 1100 0 0
Advertisement