Maximul unui vector
#include<iostream.h>
#include<conio.h>
typedef int vector[20];
int n;vector v;
int maxim(int n)
{int max;
if (n==1) return v[1];
else
{
max=maxim(n-1);
if (max<v[n]) return v[n];
else return max;
}
}
void main()
{
cout<<“n=”;cin>>n;
for(int i=1;i<=n;i++)
{cout<<“v[“<<i<<“]=”;cin>>v[i];}
cout<<maxim(n)<<endl;
getch();
}
{module orizontal600}