Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Wykonać symulację piłki zbudowanej z sieci punktów materialnych.
- // W symulacji uwzględnić ciśnienie powietrza wewnątrz piłki (zależy
- // jedynie od objętości piłki), które rozpycha punktu na zewnątrz
- // i równoważy siłę ciążenia.
- #include <iostream>
- #include <cstdlib>
- #include <cmath>
- #include <fstream>
- #define M_PI 3.14159265358979323846
- using namespace std;
- double objetosc(double r) //objetosc
- {
- return 4/3*M_PI*pow(r,3.0);
- }
- double gestosc(double m, double V) //gestosc
- {
- return m/V;
- }
- double cisnienie(double V, double n, double R, double T) //cisnienie
- {
- return (n*R*T)/V;
- }
- int main()
- {
- double r=0.2386, g=9.81, m=0.65, V, R=8.3144598, T=293, n, p;
- fstream plik;
- cout << "Symulacji pilki" << endl;
- cout << "" << endl;
- cout << "r - promien kuli (pilki) [m]" << endl;
- cout << "m - masa pilki [kg]" << endl;
- cout << "V - objetosc pilki [m3]" << endl;
- cout << "R - stała gazowa [J/mol*K]" << endl;
- cout << "p - cisnienie pilki [Pa]" << endl;
- cout << "T - temperatura [T]" << endl;
- cout << "n - ilosc gazu [mol]" << endl;
- cout << "" << endl;
- V=objetosc(r);
- while(V<10)
- {
- plik.open("wyniki.txt", ios::out| ios::app);
- p=cisnienie(V, n, R, T);
- cout << " Cisnienie pilki wynosi: " << p << " Pa" << " Objetosc pilki wynosi: " << V << " m3" << endl;
- plik << p << " " << V << endl;
- V=V+0.1;
- plik.close();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement