fork download
  1. #include <iostream>
  2. #include <string>
  3.  
  4. bool Show(int Hour, int Min){
  5. int Number[] = { 0, 11, 1, 10, 2, 9, 3, 8, 4, 7, 5, 6 };
  6. int SP[] = { 9, 4, 9, 1, 15, 0, 17, 1, 15, 4, 9, 9 };
  7.  
  8. std::cout << "input" << std::endl;
  9. std::cout << Hour << ':' << Min << std::endl;
  10. std::cout << "output" << std::endl;
  11. Hour %= 12;
  12. int NM = (Min % 60) / 5;
  13. if (Min % 5 >= 3) NM++;
  14. NM %= 12;
  15.  
  16. for (int i = 0; i < 12; i++){
  17.  
  18. for (int j = 0; j < SP[i]; j++){
  19. std::cout << ' ';
  20. }
  21. if (Number[i] == Hour && Number[i] == NM){
  22. std::cout << 'X';
  23. }else if (Number[i] == Hour){
  24. std::cout << 'X';
  25. }else if (Number[i] == NM){
  26. std::cout << 'x';
  27. }else{
  28. std::cout << 'o';
  29. }
  30.  
  31. if (i == 2)std::cout << std::endl;
  32. if (i == 4)std::cout << std::endl;
  33. if (i == 6)std::cout << std::endl;
  34. if (i == 8)std::cout << std::endl;
  35. if (i%2== 0 )std::cout << std::endl;
  36. }
  37. std::cout << std::endl;
  38. return true;
  39. }
  40.  
  41. int main(){
  42.  
  43. Show(18, 35);
  44. Show(00, 00);
  45. Show(10, 03);
  46.  
  47.  
  48. return 0;
  49.  
  50. }
Success #stdin #stdout 0s 3344KB
stdin
Standard input is empty
stdout
input
18:35
output
         o
    o         o

 o               o

o                 o

 o               o

    x         o
         X
input
0:0
output
         X
    o         o

 o               o

o                 o

 o               o

    o         o
         o
input
10:3
output
         o
    o         x

 X               o

o                 o

 o               o

    o         o
         o