fork download
  1. #include <iostream>
  2.  
  3. const std::size_t HEIGHT = 10;
  4. const std::size_t WIDTH = 10;
  5.  
  6. char graphics[WIDTH/8][HEIGHT];
  7.  
  8. inline void set_bit(std::size_t x, std::size_t y)
  9. {
  10. graphics[(x) / 8][y] |= (0x80 >> ((x) % 8));
  11. }
  12.  
  13. void print_screen(void)
  14. {
  15. for (int y = 0; y < HEIGHT; y++)
  16. {
  17. for (int x = 0; x < WIDTH/8+1; x++)
  18. {
  19. for (int i = 0x80; i != 0; i = (i >> 1))
  20. {
  21. if ((graphics[x][y] & i) != 0)
  22. std::cout << "*";
  23. else
  24. std::cout << " ";
  25. }
  26. }
  27. std::cout<<std::endl;
  28. }
  29. }
  30.  
  31. int main()
  32. {
  33. for(int x = 0; x < WIDTH; x++)
  34. {
  35. for(int y = 0; y < HEIGHT; y++)
  36. {
  37. if(x == 0 || y == 0 || x == WIDTH-1 || y == HEIGHT-1)
  38. set_bit(x,y);
  39. }
  40. }
  41. print_screen();
  42. return 0;
  43. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
**********      
*        *      
*        *      
*        *      
*        *      
*        *      
*        *      
*        *      
*        *      
**********