Advertisement
dmilicev

letters_v1.c

Dec 10th, 2019
200
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.79 KB | None
  1. /*
  2.  
  3.     letters_v1.c        by Dragan Milicev
  4.  
  5.  
  6.     Not finished.
  7.     ...
  8.     Hopefully someone will finish the declaration and initialization of all letters ...
  9.     and add them to switch() statement ...
  10.     ...
  11.  
  12.     For further development, print letters along the lines would be interesting.
  13.     Then we would have to use the outdated library conio.h and its gotoxy() function.
  14.     Maybe someone will solve it ...
  15.    
  16.  
  17.     You can find all my C programs at Dragan Milicev's pastebin:
  18.  
  19.     https://pastebin.com/u/dmilicev
  20.  
  21. */
  22.  
  23.  
  24. #include <stdio.h>
  25. #include <string.h>
  26. #include <ctype.h>
  27.  
  28.  
  29. void print_letter( int M[7][5] )
  30. {
  31.     int i, j;
  32.  
  33.     printf("\n");
  34.  
  35.     for( i=0; i<7; i++ )
  36.     {
  37.         for( j=0; j<5; j++ )
  38.         {
  39.             if ( M[i][j] == 1 )
  40.                 printf("%c", '*');
  41.             else
  42.                 printf("%c", ' ');
  43.         }
  44.         printf("\n");
  45.     }
  46.  
  47.     printf("\n");
  48.  
  49. } // print_letter()
  50.  
  51.  
  52. int main(void)
  53. {
  54.     char text[25] = "ABBA";     // string text to print, max 25 characters
  55.     int len = strlen(text);     // lenght of text
  56.     int i;
  57.  
  58.     int A[7][5] = {
  59.                     {0,0,1,0,0},
  60.                     {0,1,0,1,0},
  61.                     {1,0,0,0,1},
  62.                     {1,0,0,0,1},
  63.                     {1,1,1,1,1},
  64.                     {1,0,0,0,1},
  65.                     {1,0,0,0,1} };
  66.  
  67.     int B[7][5] = {
  68.                     {1,1,1,1,0},
  69.                     {1,0,0,0,1},
  70.                     {1,0,0,0,1},
  71.                     {1,1,1,1,0},
  72.                     {1,0,0,0,1},
  73.                     {1,0,0,0,1},
  74.                     {1,1,1,1,0} };
  75.  
  76. // ...
  77. // Hopefully someone will finish the declaration and initialization of all letters ...
  78. // and add them to switch() statement ...
  79. // ...
  80.  
  81.     printf("\n Text = |%s| \n", text);
  82.  
  83.     for( i=0; i<len; i++ )
  84.     {
  85.         switch ( toupper(text[i]) )
  86.         {
  87.             case 'A' :
  88.                         print_letter( A );
  89.                         break;
  90.             case 'B' :
  91.                         print_letter( B );
  92.                         break;
  93.             default  :
  94.                         printf("\n Character %c has not yet been declared ! \n", toupper(text[i]) );
  95.                         break;
  96.         }
  97.     }
  98.  
  99.  
  100.     return 0;
  101.  
  102. } // main()
Advertisement
RAW Paste Data Copied
Advertisement