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;
- 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();
- cout << X << "\t" << Y << "\t" << Vx << "\t" << Vy << endl;
- ofstream file;
- file.open ("/home/user/out.txt");
- while (Y>0){
- X = X + Vx*dt;
- Y = Y + Vy*dt;
- cout << X << "\t" << Y << endl;
- file << X <<"\t"<< Y << endl;
- Vy -= g * dt;
- }
- file.close();
- return 0;
- }
- //outfile-вывод
- //infale-ввод
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement