Someone
public cpp v1 · immutable#include <iostream>#include <iomanip>const int size = 100;int A[size],Temp[size];int num,pos,pos1,runner,runner1; void main(){ cout << " Enter the number: "; cin >> num; for ( int i = 0; i < num; i++ ) A[i] = 1; runner = num-1; do { for ( int j = 0; j < num; j++ ) cout << "+" << A[j]; cout << "\n\n"; cin.get(); do { for ( int j1 = 0; j1 <= num-1; j1++ ) cout << "+" << Temp[j1]; cout << "\n\n"; cin.get(); pos1 = runner1-1; Temp[pos1] = A[pos-1]; if ( pos1 > 0 && (Temp[pos1-1] += Temp[pos] <= Temp[pos] ) ) { Temp[pos1-1] += Temp[pos]; for ( int k = pos1+1; k < num; k++ ) Temp[k] = 0; } --runner1; } while ( pos1 > 0 ); pos = runner; if ( pos >= 0 ) { A[pos-1] += A[pos]; for ( int k = pos; k <= num-1; k++ ) A[k] = 0; } --runner; runner1 = runner; for ( int x = 0; x <= runner1; x++ ) Temp[x] = A[x]; for ( int x = 0; x <= runner1; x++ ) cout << Temp[x] << setw(3); } while ( pos >= 0);}