0

Hello to you all ,

i have recieved an assignment to build a recursive function
which will recieve an array which has to check if it is "Up&Down" from both sides : Example : 2 5 6 12 7 5 2 .
according to the specs of the H.W assignment , i need to find an "extreme value" (in example - 12) .

how should i approach this?

Thank you

Yotam

3
Contributors
2
Replies
3
Views
11 Years
Discussion Span
Last Post by beuls
0

Hello to you all ,

i have recieved an assignment to build a recursive function
which will recieve an array which has to check if it is "Up&Down" from both sides : Example : 2 5 6 12 7 5 2 .
according to the specs of the H.W assignment , i need to find an "extreme value" (in example - 12) .

how should i approach this?

Thank you

Yotam

up&down - makes perfect sense now :rolleyes:

0

pls try this code.

#include <iostream.h>
#include <conio.h>
int ext(int[],int,int);
void main()
{
int k,a[10],i,n,p=0;
clrscr();
cout<<"Enter size of array	:";
cin>>n;
cout<<"Enter the elements	:";
for (i=0;i<n;i++)
 cin>>a[i];
 k=ext(a,n,p);
 cout<<"The extreme element is 		:"<<k;
 getch();
 }

 int ext(int a[10],int n,int pos)
 {
  if (pos<=n)
   {
   --n;
   ++pos;
    ext(a,n,pos);
      }

   return a[++pos];
   }
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.