fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void display(unsigned val)
  5. {
  6. static const char *dig[][10]=
  7. {
  8. { " xxx ", " x " },
  9. { "x x ", " xx " },
  10. { "x x ", " x x " },
  11. { "x x ", " x " },
  12. { " xxx ", " x " }
  13. };
  14. for(int y=0;y<sizeof(dig)/sizeof(*dig);++y,cout<<endl) for(unsigned i=val;i;i/=10) cout<<dig[y][i%10];
  15. }
  16.  
  17. int main()
  18. {
  19. display(101);
  20. return 0;
  21. }
Success #stdin #stdout 0s 3296KB
stdin
5
stdout
   x   xxx     x  
  xx  x   x   xx  
 x x  x   x  x x  
   x  x   x    x  
   x   xxx     x