Advertisement
Guest User

Untitled

a guest
Jun 20th, 2017
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. //Wykonać symulację piłki zbudowanej z sieci punktów materialnych.
  2. // W symulacji uwzględnić ciśnienie powietrza wewnątrz piłki (zależy
  3. // jedynie od objętości piłki), które rozpycha punktu na zewnątrz
  4. // i równoważy siłę ciążenia.
  5. #include <iostream>
  6. #include <cstdlib>
  7. #include <cmath>
  8. #include <fstream>
  9.  
  10. #define M_PI 3.14159265358979323846
  11.  
  12. using namespace std;
  13.  
  14. double objetosc(double r) //objetosc
  15. {
  16. return 4/3*M_PI*pow(r,3.0);
  17. }
  18.  
  19. double gestosc(double m, double V) //gestosc
  20. {
  21. return m/V;
  22. }
  23.  
  24. double cisnienie(double V, double n, double R, double T) //cisnienie
  25. {
  26. return (n*R*T)/V;
  27. }
  28.  
  29. int main()
  30. {
  31. double r=0.2386, g=9.81, m=0.65, V, R=8.3144598, T=293, n, p;
  32. fstream plik;
  33. cout << "Symulacji pilki" << endl;
  34. cout << "" << endl;
  35. cout << "r - promien kuli (pilki) [m]" << endl;
  36. cout << "m - masa pilki [kg]" << endl;
  37. cout << "V - objetosc pilki [m3]" << endl;
  38. cout << "R - stała gazowa [J/mol*K]" << endl;
  39. cout << "p - cisnienie pilki [Pa]" << endl;
  40. cout << "T - temperatura [T]" << endl;
  41. cout << "n - ilosc gazu [mol]" << endl;
  42. cout << "" << endl;
  43. V=objetosc(r);
  44. while(V<10)
  45. {
  46. plik.open("wyniki.txt", ios::out| ios::app);
  47. p=cisnienie(V, n, R, T);
  48. cout << " Cisnienie pilki wynosi: " << p << " Pa" << " Objetosc pilki wynosi: " << V << " m3" << endl;
  49. plik << p << " " << V << endl;
  50. V=V+0.1;
  51. plik.close();
  52. }
  53. return 0;
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement