• API
• FAQ
• Tools
• Archive
daily pastebin goal
42%
SHARE
TWEET

# Untitled

a guest Jan 21st, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. #include <iostream>
2. #include <math.h>
3. #define g 9.80665
4.
5. using namespace std;
6.
7.
8. float licz_k(float L, float m, float H){
9.
10.     float k;
11.
12.     k = (((m*g*L)+(m*g*H))*2) / pow(H, 2);
13.
14.     return k;
15. }
16.
17. float licz_L_max(float L, float m, float V, float k){
18.
19.     float W0, A;
20.
21.     // czestosc kolowa drgan
22.     W0 = sqrt(k/m);
23.
24.     // ampituda drgan
25.     A = V/W0;
26.
27.     return A;
28. }
29.
30. int main()
31. {
32.     float L, m, T, V, k, H;
34.
35.     cout << "Podaj dlugosc liny: [m]" << endl;
36.     cin >> L;
37.     cout << "Podaj mase: [kg]" << endl;
38.     cin >> m;
39.
40.     cout << "---MENU---" << endl;
41.     cout << "1. Oblicz k" << endl;
42.     cout << "2. Oblicz maksymalne rozciągnięcie liny" << endl;
44.
45.
46.     T = sqrt((2*L)/g);
47.     V = g*T;
48.
50.     {
51.         case 1: cout << "Podaj maksymalne rozciągnięcie liny [m]" << endl;
52.                 cin >> H;
53.                 cout << "K wynosi: " << licz_k(L, m, H) << "[N/m]" << endl;
54.                 break;
55.
56.         case 2: cout << "Podaj k [N/m] " << endl;
57.                 cin >> k;
58.                 cout << "Maksymalne rozciągnięcie liny wynosi: " << licz_L_max(L, m, V, k) << "[m]" << endl;
59.                 break;
60.
61.         default: cout << "Error" <<endl;
62.     }
63.
64.
65.     system("pause");
66.
67.     return 0;
68. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

Top