/* Seven Segment Indicators (Letters) (15 pt) Seven Segment indicators are commonly used to display numbers 0-9. It is possible, however, to represent some letters as well. For example the first six letters of the English alphabet that are also used in the hexadecimal number system can be displayed as: _ _ _ _ |_| |_ | _| |_ |_ | | |_| |_ |_| |_ | Write a complete C program that generates two random letters in the range [A .. F] and prints them on the screen using an ASCII encoding of their seven-segment indicator representation (as shown in the sample runs given below). The program must come up with a different pair of letters every time you run it. It is OK if during some (but not all) runs the two random letters are the same. SAMPLE RUN #1: _ _ |_| |_ | | | SAMPLE RUN #2: _ |_ _| |_ |_| SAMPLE RUN #3: _ | |_ |_ |_| */ #include #include #include int main() { char number[10][3][3]= { /* A */ {{' ', '_', ' '}, {'|', '_', '|'}, {'|', ' ', '|'}}, /* B */ {{' ', ' ', ' '}, {'|', '_', ' '}, {'|', '_', '|'}}, /* C */ {{' ', '_', ' '}, {'|', ' ', ' '}, {'|', '_', ' '}}, /* D */ {{' ', ' ', ' '}, {' ', '_', '|'}, {'|', '_', '|'}}, /* E */ {{' ', '_', ' '}, {'|', '_', ' '}, {'|', '_', ' '}}, /* F */ {{' ', '_', ' '}, {'|', '_', ' '}, {'|', ' ', ' '}}, }; int i,j,k; int n1, n2; srand ( time(NULL) ); // initialize the random number generator n1 = rand()%6; // generate a random number [0..5] n2 = rand()%6; // generate a second random number // print the two side by side for(i=0; i<3; i++) { for(j=0; j<3; j++) printf("%c", number[n1][i][j]); printf(" "); for(j=0; j<3; j++) printf("%c", number[n2][i][j]); printf("\n"); } printf("\n"); system("pause"); }