fork download
  1.  
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4.  
  5. unsigned int data[][10] ={
  6. // 0 1 2 3 4 5 6 7 8 9
  7. { 0,0,0,0,1,1,1,0,0,0}, // 0
  8. { 0,0,0,1,0,0,0,1,0,0}, // 1
  9. { 0,0,1,0,0,0,0,0,1,0}, // 2
  10. { 0,0,1,0,0,0,0,0,1,0}, // 3
  11. { 0,0,1,1,1,1,1,1,1,0}, // 4
  12. { 0,1,0,0,0,0,0,0,0,1}, // 5
  13. { 0,1,0,0,0,0,0,0,0,1}, // 6
  14. { 0,1,0,0,0,0,0,0,0,1}, // 7
  15. { 0,1,0,0,0,0,0,0,0,1}, // 8
  16. { 0,0,0,0,0,0,0,0,0,0}, // 9
  17. };
  18.  
  19. void usage(void)
  20. {
  21. printf("command [option] [arg]");
  22. exit(0);
  23. }
  24.  
  25. enum{
  26. TRUE = 1,
  27. FALSE = 0,
  28. MIN_X = 0,
  29. MAX_X = 10,
  30. MIN_Y = 0,
  31. MAX_Y = 10,
  32. ON = 0x1,
  33. };
  34.  
  35. int main(int argc, char*argv[])
  36. {
  37. int i;
  38. int x;
  39. int y;
  40. int debug = FALSE;
  41. int bold = FALSE;
  42. int reverse = FALSE;
  43. for (i = 1; i < argc; i++)
  44. {
  45. if (argv[i][0] == '-') {
  46. switch(argv[i][1])
  47. {
  48. case 'd': debug = TRUE; break;
  49. case 'b': bold = TRUE; break;
  50. case 'r': reverse = TRUE; break;
  51. case 'e': usage();
  52. default: usage();
  53. }
  54. }
  55. }
  56.  
  57. if (debug == TRUE)
  58. {
  59. if (debug == TRUE) printf("debug = ON");
  60. if (bold == TRUE) printf("bold = ON");
  61. if (reverse == TRUE) printf("reverse = ON");
  62. }
  63.  
  64. for (y = MIN_Y; y < MAX_Y; y++)
  65. {
  66. for (x = MIN_X; x < MAX_X; x++)
  67. {
  68. if (reverse == TRUE)
  69. {
  70. if (data[y][x] == ON) printf("_");
  71. else printf("X");
  72. } else {
  73. if (data[y][x] == ON) printf("X");
  74. else printf("_");
  75. }
  76. }
  77. printf("\n");
  78. }
  79. }
  80.  
Runtime error #stdin #stdout 0.01s 1720KB
stdin
Standard input is empty
stdout
____XXX___
___X___X__
__X_____X_
__X_____X_
__XXXXXXX_
_X_______X
_X_______X
_X_______X
_X_______X
__________