All pastes #546719 Raw Edit

Mine

public cpp v1 · immutable
·published 2007-06-07 04:23 UTC
rendered paste body
/*Liet ke các tap con cua tap S gòm n so nguyen { S[1], S[2],...S[n] } nhap vào tù bàn phím. */#include <iostream>#include <iomanip>const int size = 100;int A[size], TEMP[size];int n;void main(){        cout << "How many element would you like: "; cin >> n;                int x = 0;        do         {                cout << "Enter the element " << x + 1 << " : ";                cin >> A[x];                x++;                cout << endl;        } while ( x < n );                     for ( int x = 0; x < n; x++ ) TEMP[x] = 0;            int POS;      do       {              for ( int x = 0; x < n; x++ )              {                      if ( TEMP[x] != 0 ) cout << TEMP[x] << setw(4);              }              cout << endl; cin.get();                                                          POS = n-1;                      while ( POS >= 0 && TEMP[POS] != 0  ) POS--;                                                    if ( POS >= 0 )                      {                              TEMP[POS] = A[POS] ;                                      for ( int j = POS + 1; j < n; j++ )                                              TEMP[j] = 0;                                                            }      }      while ( POS >= 0 );                cin >> n;}