Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- struct polozenie{
- double x,y,z;
- };
- struct predkosc{
- double x,y,z;
- };
- const double g = 9.80665;
- polozenie funkcja(polozenie P, predkosc V, int t)
- {
- //funkcja przyjmuje polozenie poczatkowe,
- //predkosc poczatkowa i czas,
- //a zwraca polozenie koncowe
- //(3 wspolrzedne) w formie struktury
- polozenie koncowe;
- koncowe.x = P.x + V.x*t;
- koncowe.y = P.y + V.y*t - g*t*t/2;
- koncowe.z = P.z + V.z*t;
- return koncowe;
- }
- int main()
- {
- polozenie P,Q;
- predkosc V;
- int t;
- cout << "Podaj polozenie (x, y, z):\n\n";
- cin >> P.x >> P.y >> P.z;
- cout << "Podaj predkosc (x, y, z):\n\n";
- cin >> V.x >> V.y >> V.z;
- cout << "Podaj czas (sekundy):\n\n";
- cin >> t;
- Q = funkcja(P, V, t);
- cout << "\nx:" << Q.x << "\n";
- cout << "y:" << Q.y << "\n";
- cout << "z:" << Q.z << "\n";
- system("PAUSE");
- return 0;
- }
Add Comment
Please, Sign In to add comment