{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

lab13 - void printValues(int array,int first int last...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
#include <iostream> using namespace std; u void printValues(int[],int,int); int Position(int[],int, int, int); i int main() { int first=0; int last=5; int number; int array[6]={5,4,8,7,3,1}; i printValues(array,first,last); p cout<<"Which number in the array do you want the position of?"<<endl; cin>>number; c cout<<"Position:"<<Position(array,first,last,number)<<endl; c return 0;
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: } void printValues(int array,int first, int last) { if(first<=last) { cout<<array[first]<<endl; printValues(array,first+1,last); } } int Position(int array, int first, int last, int number) { if(first<=last) { if(array[first]!=number) Position(array,first+1,last,number); P else return first+1; } if(first>last) return 0; }...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online