question2

question2 - findUnordered(nums, 6,ptr) if (ptr==NULL) {

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

View Full Document Right Arrow Icon
Sheet1 Page 1 #include <iostream> using namespace std { for(int k =1 k<n k++) { if (arr[k]>arr[k-1]) { pBad=arr+k return } } pBad=NULL } int main() { double nums[6]={45.3, 47.9, 25.8,80.4,15.3,2.5} double *ptr
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: findUnordered(nums, 6,ptr) if (ptr==NULL) { cout&lt;&lt;&quot;The array is ordered&quot;&lt;&lt;endl } else { cout&lt;&lt;&quot;The disorder is at address&quot;&lt;&lt;ptr&lt;&lt;endl cout&lt;&lt;&quot;It's at index&quot;&lt;&lt;ptr-nums&lt;&lt;endl cout&lt;&lt;&quot;The item's value is&quot;&lt;&lt;*ptr&lt;&lt;endl } }...
View Full Document

Ask a homework question - tutors are online