Guest User

Untitled

a guest
Feb 18th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 10.58 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <stdlib.h>
  4. #include <windows.h>
  5. #include <time.h>
  6.  
  7.  
  8. void gotoxy(int x, int y) {
  9.   COORD c;
  10.   c.X = x - 1;
  11.   c.Y = y - 1;
  12.   SetConsoleCursorPosition (GetStdHandle(STD_OUTPUT_HANDLE), c);
  13. }
  14.  
  15. int main(void)
  16. {
  17.  
  18.     char texto[12];
  19.     int var;
  20.     char letra[27][5][6]= {
  21.                           {
  22.                             {' ',' ',' ',' ',' ',' '}, //ESPAÇO
  23.                             {' ',' ',' ',' ',' ',' '},
  24.                             {' ',' ',' ',' ',' ',' '},
  25.                             {' ',' ',' ',' ',' ',' '},
  26.                             {' ',' ',' ',' ',' ',' '}
  27.                           },
  28.                           {
  29.                             {'#','#','#','#','#',' '}, //A
  30.                             {'#',' ',' ',' ','#',' '},
  31.                             {'#','#','#','#','#',' '},
  32.                             {'#',' ',' ',' ','#',' '},
  33.                             {'#',' ',' ',' ','#',' '}
  34.  
  35.                           },
  36.                           {
  37.                             {'#','#','#','#',' ',' '},  //B
  38.                             {'#',' ',' ','#',' ',' '},
  39.                             {'#','#','#','#','#',' '},
  40.                             {'#',' ',' ',' ','#',' '},
  41.                             {'#','#','#','#','#',' '}
  42.                           },
  43.                           {
  44.                             {'#','#','#','#','#',' '},  //C
  45.                             {'#',' ',' ',' ',' ',' '},
  46.                             {'#',' ',' ',' ',' ',' '},
  47.                             {'#',' ',' ',' ',' ',' '},
  48.                             {'#','#','#','#','#',' '}
  49.                           },
  50.                           {
  51.                             {'#','#','#','#',' ',' '},  //D
  52.                             {'#',' ',' ',' ','#',' '},
  53.                             {'#',' ',' ',' ','#',' '},
  54.                             {'#',' ',' ',' ','#',' '},
  55.                             {'#','#','#','#',' ',' '}
  56.                           },
  57.                           {
  58.                             {'#','#','#','#','#',' '},  //E
  59.                             {'#',' ',' ',' ',' ',' '},
  60.                             {'#','#','#','#','#',' '},
  61.                             {'#',' ',' ',' ',' ',' '},
  62.                             {'#','#','#','#','#',' '}
  63.                           },
  64.                           {
  65.                             {'#','#','#','#','#',' '},  //F
  66.                             {'#',' ',' ',' ',' ',' '},
  67.                             {'#','#','#',' ',' ',' '},
  68.                             {'#',' ',' ',' ',' ',' '},
  69.                             {'#',' ',' ',' ',' ',' '}
  70.                           },
  71.                           {
  72.                             {'#','#','#','#','#',' '}, //G
  73.                             {'#',' ',' ',' ',' ',' '},
  74.                             {'#',' ','#','#','#',' '},
  75.                             {'#',' ',' ',' ','#',' '},
  76.                             {'#','#','#','#','#',' '}
  77.                           },
  78.                           {
  79.                             {'#',' ',' ',' ','#',' '},  //H
  80.                             {'#',' ',' ',' ','#',' '},
  81.                             {'#','#','#','#','#',' '},
  82.                             {'#',' ',' ',' ','#',' '},
  83.                             {'#',' ',' ',' ','#',' '}
  84.                           },
  85.                           {
  86.                             {' ',' ','#',' ',' ',' '},  //I
  87.                             {' ',' ','#',' ',' ',' '},
  88.                             {' ',' ','#',' ',' ',' '},
  89.                             {' ',' ','#',' ',' ',' '},
  90.                             {' ',' ','#',' ',' ',' '}
  91.                           },
  92.                           {
  93.                             {'#','#','#','#','#',' '},  //J
  94.                             {' ',' ','#',' ',' ',' '},
  95.                             {' ',' ','#',' ',' ',' '},
  96.                             {'#',' ','#',' ',' ',' '},
  97.                             {'#','#','#',' ',' ',' '}
  98.                           },
  99.                           {
  100.                             {'#',' ',' ','#',' ',' '},  //K
  101.                             {'#',' ','#',' ',' ',' '},
  102.                             {'#','#',' ',' ',' ',' '},
  103.                             {'#',' ','#',' ',' ',' '},
  104.                             {'#',' ',' ','#',' ',' '}
  105.                           },
  106.                           {
  107.                             {'#',' ',' ',' ',' ',' '}, //L
  108.                             {'#',' ',' ',' ',' ',' '},
  109.                             {'#',' ',' ',' ',' ',' '},
  110.                             {'#',' ',' ',' ',' ',' '},
  111.                             {'#','#','#','#','#',' '}
  112.                           },
  113.                           {
  114.                             {'#',' ',' ',' ','#',' '}, //M
  115.                             {'#','#',' ','#','#',' '},
  116.                             {'#',' ','#',' ','#',' '},
  117.                             {'#',' ',' ',' ','#',' '},
  118.                             {'#',' ',' ',' ','#',' '}
  119.                           },
  120.                           {
  121.                             {'#',' ',' ',' ','#',' '},  //N
  122.                             {'#','#',' ',' ','#',' '},
  123.                             {'#',' ','#',' ','#',' '},
  124.                             {'#',' ',' ','#','#',' '},
  125.                             {'#',' ',' ',' ','#',' '}
  126.                           },
  127.                           {
  128.                             {' ','#','#','#',' ',' '},  //O
  129.                             {'#',' ',' ',' ','#',' '},
  130.                             {'#',' ',' ',' ','#',' '},
  131.                             {'#',' ',' ',' ','#',' '},
  132.                             {' ','#','#','#',' ',' '}
  133.                           },
  134.                           {
  135.                             {'#','#','#','#','#',' '}, //P
  136.                             {'#',' ',' ',' ','#',' '},
  137.                             {'#','#','#','#','#',' '},
  138.                             {'#',' ',' ',' ',' ',' '},
  139.                             {'#',' ',' ',' ',' ',' '}
  140.                           },
  141.                           {
  142.                             {' ','#','#','#',' ',' '},  //Q
  143.                             {'#',' ',' ',' ','#',' '},
  144.                             {'#',' ',' ',' ','#',' '},
  145.                             {' ','#','#','#',' ',' '},
  146.                             {' ',' ',' ',' ','#',' '}
  147.                           },
  148.                           {
  149.                             {'#','#','#','#','#',' '}, //R
  150.                             {'#',' ',' ',' ','#',' '},
  151.                             {'#','#','#','#','#',' '},
  152.                             {'#',' ','#',' ',' ',' '},
  153.                             {'#',' ',' ','#','#',' '}
  154.                           },
  155.                           {
  156.                             {' ','#','#','#','#',' '}, //S
  157.                             {'#',' ',' ',' ',' ',' '},
  158.                             {' ','#','#','#',' ',' '},
  159.                             {' ',' ',' ',' ','#',' '},
  160.                             {'#','#','#','#',' ',' '}
  161.                           },
  162.                           {
  163.                             {'#','#','#','#','#',' '},  //T
  164.                             {' ',' ','#',' ',' ',' '},
  165.                             {' ',' ','#',' ',' ',' '},
  166.                             {' ',' ','#',' ',' ',' '},
  167.                             {' ',' ','#',' ',' ',' '}
  168.                           },
  169.                           {
  170.                             {'#',' ',' ',' ','#',' '},  //U
  171.                             {'#',' ',' ',' ','#',' '},
  172.                             {'#',' ',' ',' ','#',' '},
  173.                             {'#',' ',' ',' ','#',' '},
  174.                             {' ','#','#','#',' ',' '}
  175.                           },
  176.                           {
  177.                             {'#',' ',' ',' ','#',' '},  //V
  178.                             {'#',' ',' ',' ','#',' '},
  179.                             {'#',' ',' ',' ','#',' '},
  180.                             {' ','#',' ','#',' ',' '},
  181.                             {' ',' ','#',' ',' ',' '}
  182.                           },
  183.                           {
  184.                             {'#',' ',' ',' ','#',' '},  //W
  185.                             {'#',' ',' ',' ','#',' '},
  186.                             {'#',' ','#',' ','#',' '},
  187.                             {'#','#',' ','#','#',' '},
  188.                             {'#',' ',' ',' ','#',' '}
  189.                           },
  190.                           {
  191.                             {'#',' ',' ',' ','#',' '},  //X
  192.                             {' ','#',' ','#',' ',' '},
  193.                             {' ',' ','#',' ',' ',' '},
  194.                             {' ','#',' ','#',' ',' '},
  195.                             {'#',' ',' ',' ','#',' '}
  196.                           },
  197.                           {
  198.                             {'#',' ',' ',' ','#',' '},  //Y
  199.                             {' ','#',' ','#',' ',' '},
  200.                             {' ',' ','#',' ',' ',' '},
  201.                             {' ',' ','#',' ',' ',' '},
  202.                             {' ',' ','#',' ',' ',' '}
  203.                           },
  204.                           {
  205.                             {'#','#','#','#','#',' '},  //Z
  206.                             {' ',' ',' ','#',' ',' '},
  207.                             {' ',' ','#',' ',' ',' '},
  208.                             {' ','#',' ',' ',' ',' '},
  209.                             {'#','#','#','#','#',' '}
  210.                           }};
  211.  
  212.     printf("Digite um texto de ate 40 caracteres.\n");
  213.     gets(texto);
  214.     var=strlen(texto);
  215.     ;
  216.  
  217.     char resultado[5][6*var],caractere;
  218.     int i;
  219.  
  220.     for (i=0; i<var ; i++)
  221.     {
  222.         if ((texto[i]<97 || texto[i]>122) && texto[i]!=32)
  223.         {
  224.             printf("Texto invalido.\n");
  225.             return 0;
  226.         }
  227.  
  228.         caractere=texto[i];
  229.  
  230.         int linha, coluna;
  231.  
  232.         for (linha=0 ; linha<5 ; linha++)
  233.         {
  234.             for (coluna=0 ; coluna<6 ; coluna++)
  235.             {
  236.                 if (caractere!=32)
  237.                 {
  238.                     resultado[linha][coluna+i*6]=letra[caractere-96][linha][coluna];
  239.                 }
  240.                 else{resultado[linha][coluna+i*6]=letra[0][linha][coluna];}
  241.             }
  242.         }
  243.  
  244.  
  245.  
  246.     }
  247.  
  248.     int j,k;
  249.  
  250.     do
  251.     {
  252.         for(k=0 ; k<=var ; k++)
  253.         {
  254.             gotoxy(1,8);
  255.             for(i=0 ; i<5 ; i++)
  256.             {
  257.                 for(j=0 ; j<70 ; j++)
  258.                 {
  259.                     printf("%c",resultado[i][k+j]);
  260.  
  261.  
  262.                 }
  263.                 printf("\n");
  264.  
  265.             }
  266.  
  267.             sleep(100);
  268.             system("cls");
  269.         }
  270.     }while(1==1);
  271.  
  272.  
  273.  
  274.  
  275. }
Add Comment
Please, Sign In to add comment