Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- letters_v1.c by Dragan Milicev
- Not finished.
- ...
- Hopefully someone will finish the declaration and initialization of all letters ...
- and add them to switch() statement ...
- ...
- For further development, print letters along the lines would be interesting.
- Then we would have to use the outdated library conio.h and its gotoxy() function.
- Maybe someone will solve it ...
- You can find all my C programs at Dragan Milicev's pastebin:
- https://pastebin.com/u/dmilicev
- */
- #include <stdio.h>
- #include <string.h>
- #include <ctype.h>
- void print_letter( int M[7][5] )
- {
- int i, j;
- printf("\n");
- for( i=0; i<7; i++ )
- {
- for( j=0; j<5; j++ )
- {
- if ( M[i][j] == 1 )
- printf("%c", '*');
- else
- printf("%c", ' ');
- }
- printf("\n");
- }
- printf("\n");
- } // print_letter()
- int main(void)
- {
- char text[25] = "ABBA"; // string text to print, max 25 characters
- int len = strlen(text); // lenght of text
- int i;
- int A[7][5] = {
- {0,0,1,0,0},
- {0,1,0,1,0},
- {1,0,0,0,1},
- {1,0,0,0,1},
- {1,1,1,1,1},
- {1,0,0,0,1},
- {1,0,0,0,1} };
- int B[7][5] = {
- {1,1,1,1,0},
- {1,0,0,0,1},
- {1,0,0,0,1},
- {1,1,1,1,0},
- {1,0,0,0,1},
- {1,0,0,0,1},
- {1,1,1,1,0} };
- // ...
- // Hopefully someone will finish the declaration and initialization of all letters ...
- // and add them to switch() statement ...
- // ...
- printf("\n Text = |%s| \n", text);
- for( i=0; i<len; i++ )
- {
- switch ( toupper(text[i]) )
- {
- case 'A' :
- print_letter( A );
- break;
- case 'B' :
- print_letter( B );
- break;
- default :
- printf("\n Character %c has not yet been declared ! \n", toupper(text[i]) );
- break;
- }
- }
- return 0;
- } // main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement