#include using namespace std; const int MAX = 100; struct card { int val; bool up; } cards[MAX]; int ileft, iright; void print(int n) { for(int i=0; i> n; while (n > 0) { ipile++; for(int i=0; i> ch; cards[i].val = i+1; cards[i].up = (ch == 'U'); } ileft = 0; iright = n-1; char ch; for(int i=0; i> ch; if (ch == 'L') { for(int j=0; j<=ileft/2; j++) { card c = cards[j]; cards[j] = cards[ileft-j]; cards[ileft-j] = c; } for(int j=0; j<=ileft; j++) cards[j].up = !cards[j].up; ileft++; } else { int k=n-1; int j=iright; while (j < k) { card c = cards[j]; cards[j] = cards[k]; cards[k] = c; j++; k--; } for(int j=iright; j> m; for(int i=0; i> index; cout << "Card " << index << " is a face "; if (cards[index-1].up) cout << "up "; else cout << "down "; cout << cards[index-1].val << "." << endl; } cin >> n; } }