1.
#include <iostream.h>
#include <fstream.h>
int n, x, y, p;
int main()
{
ifstream fin("numere.txt");
fin >> n;
fin >> x;
n--;
p = 1;
while( n )
{
fin >> y;
if( x > y) p++;
n--;
}
cout << p << endl;
fin.close();
system("pause");
return 0;
}
2.
#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) { 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++;}
}