Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<fstream>
- using namespace std;
- int main()
- {
- ifstream f("v19s3e4NR1.txt");
- ifstream g("v19s3e4NR2.txt");
- int x,y,i=1,j=1,n,m;
- f>>n;
- g>>m;
- f>>x;
- g>>y;
- while(i<=n && j<=m)
- {
- if(x<y)
- {
- cout<<x<<' ';
- f>>x;
- i++;
- }
- else if(y<x)
- {
- cout<<y<<' ';
- g>>y;
- j++;
- }
- else
- {
- cout<<x<<' ';
- f>>x;
- g>>y;
- i++;
- j++;
- }
- }
- while(i<=n)
- {
- cout<<x<<' ';
- f>>x;
- i++;
- }
- while(j<=m)
- {
- cout<<y<<' ';
- g>>y;
- j++;
- }
- f.close();
- g.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement