Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <sstream>
- #include <fstream>
- #include <string>
- using namespace std;
- int main(){
- float g=9.81;
- string path ="/home/user/orbs.txt";
- ifstream infile (path.c_str());
- string line;
- getline (infile, line);
- istringstream iny (line.c_str());
- float x, y, Vx, Vy, dt;
- iny >> x >> y >> Vx >> Vy >> dt;
- infile.close();
- ofstream file;
- file.open("/home/user/out.txt");
- while(y>0){
- x= x + Vx * dt;
- y= y + Vy * dt;
- file << x << " " << y << "\n";
- Vy -=g * dt;
- }
- file.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement