Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<fstream>
- #include<string.h>
- using namespace std;
- //ifstream fin("bac.in");
- //ofstream fout("bac.out");
- int maxim (int v[100], int &n)
- {
- int nrmax=INT_MIN, i,j;
- for(i=1; i<=n; i++)
- if(nrmax<v[i])
- nrmax=v[i];
- for(i=n; i>=1; i--)
- {
- if(v[i]==nrmax)
- {
- for(j=i; j<n; j++)
- v[j]=v[j+1];
- n--;
- }
- }
- return nrmax;
- }
- int v[100];
- int main ()
- {
- int n=0,i, j,x, aux;
- while (cin>>x)
- {
- v[++n]=x;
- }
- while (n>0)
- {
- cout<<maxim(v,n)<<" ";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement