Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <fstream>
- #include <sstream>
- using namespace std;
- int main()
- {
- float g=9.8;
- ifstream infile("/home/user/in.txt");
- 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 << endl;
- vy-=g*dt;
- }
- file.close();
- return 0;
- }
Add Comment
Please, Sign In to add comment