abubaca

D

Oct 20th, 2018
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.18 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. char mask[10][3][3]=
  6. {
  7.     {
  8.         {' ','_',' '},
  9.         {'|',' ','|'},
  10.         {'|','_','|'}
  11.     },
  12.     {
  13.         {' ',' ',' '},
  14.         {' ',' ','|'},
  15.         {' ',' ','|'}
  16.     },
  17.     {
  18.         {' ','_',' '},
  19.         {' ','_','|'},
  20.         {'|','_',' '}
  21.     },
  22.     {
  23.         {' ','_',' '},
  24.         {' ','_','|'},
  25.         {' ','_','|'}
  26.     },
  27.     {
  28.         {' ',' ',' '},
  29.         {'|','_','|'},
  30.         {' ',' ','|'}
  31.     },
  32.     {
  33.         {' ','_',' '},
  34.         {'|','_',' '},
  35.         {' ','_','|'}
  36.     },
  37.     {
  38.         {' ','_',' '},
  39.         {'|','_',' '},
  40.         {'|','_','|'}
  41.     },
  42.     {
  43.         {' ','_',' '},
  44.         {' ',' ','|'},
  45.         {' ',' ','|'}
  46.     },
  47.     {
  48.         {' ','_',' '},
  49.         {'|','_','|'},
  50.         {'|','_','|'}
  51.     },
  52.     {
  53.         {' ','_',' '},
  54.         {'|','_','|'},
  55.         {' ','_','|'}
  56.     }
  57. };
  58.  
  59. int acii_numbers(char input[3][3])
  60. {
  61.     for (int i=0; i<=9;i++)
  62.         if (input == mask[i])
  63.             return i;
  64. }
  65.  
  66. int main()
  67. {
  68.     string first,second,third;
  69.     getline(cin, first);
  70.     getline(cin, second);
  71.     getline(cin, third);
  72.     for (int i=1; i <= first.length(); i++)
  73.         if (i % 4 == 3)
  74.         {
  75.             char temp[3][3] = {
  76.                 {first[i-2],first[i-1],first[i]},
  77.                 {second[i-2],second[i-1],second[i]},
  78.                 {third[i-2],third[i-1],third[i]}
  79.             };
  80.             cout << acii_numbers(temp) << endl;
  81.         }
  82.     return 0;
  83. }
Advertisement
Add Comment
Please, Sign In to add comment