Varianta 20 / Subiectul 3 / Problema 4 |
#include<fstream.h> void main() { ifstream f("nr1.txt"), g("nr2.txt"); int x,y,n,m,i,j; f>>n; g>>m; i=j=1; f>>x; g>>y; while(i<=n && j<=m) if(x<y) { f>>x; i++;} else if(y<x) { g>>y; j++; } else { cout<<x<<" "; f>>x; g>>y; i++; j++; } } |