Advertisement
High_Light

orbs

Dec 8th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. #include <iostream>
  2. #include <sstream>
  3. #include <fstream>
  4. #include <string>
  5.  
  6. using namespace std;
  7.  
  8. int main(){
  9.     float g=9.81;
  10.     string path ="/home/user/orbs.txt";
  11.     ifstream infile (path.c_str());
  12.     string line;
  13.     getline (infile, line);
  14.     istringstream iny (line.c_str());
  15.     float x, y, Vx, Vy, dt;
  16.     iny >> x >> y >> Vx >> Vy >> dt;
  17.     infile.close();
  18.  
  19.     ofstream file;
  20.  
  21.     file.open("/home/user/out.txt");
  22.     while(y>0){
  23.         x= x + Vx * dt;
  24.         y= y + Vy * dt;
  25.         file << x << "  " << y << "\n";
  26.         Vy -=g * dt;
  27.     }
  28.     file.close();
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement