Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- using namespace std;
- int main() {
- fstream A("A.txt"), B("B.txt"), C("C.txt", std::fstream::out);
- float t1, t2, t3, inp;
- t1 = t2 = t3 = 0;
- while(A >> inp)
- if(inp > 0 && inp < 1)
- C << inp << endl;
- while(B >> inp) {
- t3 = t2;
- t2 = t1;
- t1 = inp;
- if(inp > 0 && inp < 1)
- C << inp << endl;
- }
- A.close();
- A.open("A.txt", std::fstream::in | std::fstream::app);
- A << endl << t3 << endl << t2 << endl << t1;
- A.close();
- B.close();
- C.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement