Untitled

 avatar
unknown
plain_text
a year ago
990 B
2
Indexable
#include <iostream>
#include <cmath>
#include <chrono>

using namespace std;

const double g = 9.81;

int main() {
	setlocale(LC_ALL, "Russian");
	double v, angle, height, x, y, step, time_of_flight;

	cout << "Задай скорость(м/c): \n";
	cin >> v;
	cout << "Задай угол запуска(градусы): \n";
	cin >> angle;
	cout << "Задай высоту(м): ";
	cin >> height;

	step = 10;
	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