kilolilo

Untitled

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