Print all maximal increasing contiguous sub | C ++ Implementation to print all the Maximal Increasing Sub - array of array ; Function to print each of maximal contiguous increasing subarray ; Loop to iterate through the array and print the maximal contiguous increasing subarray . ; Condition to check whether the element at i , is greater than its next neighbouring element or not . ; Driver function
#include <bits/stdc++.h> NEW_LINE using namespace std ; void printmaxSubseq ( int arr [ ] , int n ) { int i ; for ( i = 0 ; i < n ; i ++ ) { if ( arr [ i ] < arr [ i + 1 ] ) cout << arr [ i ] << " ▁ " ; else cout << arr [ i ] << " STRNEWLINE " ; } } int main ( ) { int arr [ ] = { 9 , 8 , 11 , 13 , 10 , 15 , 14 , 16 , 20 , 5 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; printmaxSubseq ( arr , n ) ; return 0 ; }