Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
2Activity
0 of .
Results for:
No results containing your search query
P. 1
Elements of an array converted to absolute values by using recursion

Elements of an array converted to absolute values by using recursion

Ratings: (0)|Views: 145|Likes:
Published by Ahmad Faridi
answer to reinforcement 4.3 about converting elements of an array into absolute value using recursion!
answer to reinforcement 4.3 about converting elements of an array into absolute value using recursion!

More info:

Published by: Ahmad Faridi on Jun 26, 2009
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less

10/02/2013

pdf

text

original

 
/*Reinforcement 4.3give an algorithm that uses tail recursion to convert every element inan integer array A into its absolute vale.*/#include <iostream>#include <cmath>using namespacestd; intabsolute(intArr[],intsize)// the function {if(size < 0)return0;else{if(Arr[size-1] < 0){Arr[size-1] = abs(Arr[size-1]);absolute(Arr,size-1);}}}intmain()//driver programme{int* Array;intsize;cout <<"how many values "<< endl;cin >> size;Array =new int[size]; intval;cout <<"please input the values "<< endl;for(inti =0; i< size; i++) {cin >> val;Array[i]= val;}absolute(Array,size);

Activity (2)

You've already reviewed this. Edit your review.
1 thousand reads
1 hundred reads

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->