Numbers printed with characters
Hello, i have to make a program that would print out numbers represented with characters like this:
8317
Code:
+--+ +--+ + +--+
! ! ! ! !
+--+ +--+ + +
! ! ! ! !
+--+ +--+ + !
srry i could get itto look any better, the first number is 8 and then 3 and so on...
So far i did this:
Code:
#include <stdio.h>
int main()
{
char *deliStevilke[]={ // numbers representet with characters
"+--+", // 0
"+ +", // 1
"! !", // 2
" +", // 3
" !", // 4
"! ", // 5
"+", // 6
"!", // 7
};
int stevilke[10][5]={ // numbers how they are to be printed on the screen
{0,2,1,2,0}, // 0
{6,7,6,7,6}, // 1
{0,4,0,5,0}, // 2
{0,4,0,4,0}, // 3
{1,2,0,4,3}, // 4
{0,5,0,4,0}, // 5
{0,5,0,2,0}, // 6
{0,4,3,4,3}, // 7
{0,2,0,2,0}, // 8
{0,2,0,4,0}, // 9
};
int stevilo;
scanf("%d", &stevilo);
// print the number in character style
printf("%s\n", deliStevilke[stevilke[stevilo][0]]);
printf("%s\n", deliStevilke[stevilke[stevilo][1]]);
printf("%s\n", deliStevilke[stevilke[stevilo][2]]);
printf("%s\n", deliStevilke[stevilke[stevilo][3]]);
printf("%s\n", deliStevilke[stevilke[stevilo][4]]);
return 0;
}
I have no truble printing if you put in 1 number like 9. I dont know what to add so that i could print a number like 9999.
Could somebody give me some idea what to do?
Thank you.
bnk