Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void interclasare()
- {
- ifstream fin1("file1.txt"),fin2("file2.txt");
- ofstream fout("file.out");
- int n, m, nr1, nr2;
- fin1>>n;
- fin2>>m;
- int i=0,j=0;
- fin1>>nr1;
- fin2>>nr2;
- while(i<n&&j<m)
- if(nr1<nr2)
- fout<<nr1<<' ',++i,fin1>>nr1;
- else
- fout<<nr2<<' ',++j,fin2>>nr2;
- while(i<n)
- fout<<nr1<<' ',++i,fin1>>nr1;
- while(j<m)
- fout<<nr2<<' ',++j,fin2>>nr2;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement