Untitled
unknown
plain_text
2 years ago
1.1 kB
5
Indexable
#include <iostream>
#include <cmath>
#include <chrono>
#include <thread>
using namespace std;
const double g = 9.81;
int main() {
setlocale(LC_ALL, "Russian");
double v, angle, height, x, y, step, time_of_flight;
int quantity_of_points;
cout << "Задай скорость(м/c): \n";
cin >> v;
cout << "Задай угол запуска(градусы): \n";
cin >> angle;
cout << "Задай высоту(м): ";
cin >> height;
step = 10;
quantity_of_points = 20;
x = 0;
time_of_flight = (2 * v * sin(angle)) / g;
cout << int(time_of_flight);
y = height * x * tan(angle) - (g * pow(x, 2)) / (2 * pow(v, 2) * pow(cos(angle), 2));
auto start = chrono::high_resolution_clock::now();
while (1) {
x += step;
cout << "Координаты точки: (" << x << ';' << y << ')' << endl;
auto now = chrono::high_resolution_clock::now();
auto duration = chrono::duration_cast<chrono::milliseconds>(now - start);
if (duration.count() >= int(time_of_flight) * 1000) {
break;
}
}
}
Editor is loading...
Leave a Comment