With your remaining time in the workshop write a C function called displaySymbolic that takes a 2-D array called A with 8 columns and 8 rows and displays its values according to the following key: If a value is less than one it should print a \".\" (full-stop character) If a value is greater than or equal to one but less than five it should display a \"-\"character. If a value is greater than or equal to five but less than 10 it should display a \"+\" character. If a value is greater than or equal to ten it should display a \"*\" character. Thus, if given the array of values: {{0, 0, 1, 1, 2, 2, 6, 6}, {0, 0, 1, 1, 2, 6, 6, 10}, {0, 0, 1, 1, 2, 6, 6, 10}, {0, 0, 1, 1, 2, 6, 6, 10}, {0, 0, 1, 1, 2, 6, 10, 10}, {0, 0, 1, 1, 2, 6, 10, 10}, {0, 0, 1, 1, 5, 6, 10, 10}, {0, 0, 1, 1, 5, 6, 10, 10}} displaySymbolic will display:.. - - - - + +.. - - - + + *.. - - - + + *.. - - - + + *.. - - - + * *.. - - - + * *.. - - + + * *.. - - + + * *
Let us just describe the displaySymbolic function to get our desired output. Let us assume that arrSymbol[8][8] as the two-dimensional array from where we will take inputs for our function. iCounter and jCounter are the two variables used to access row and column of the two-dimensional array.
int iCounter, jCounter;
void displaySymbolic(){
for(iCounter=0;iCounter<7;iCounter++){
for(jCounter=0;jCounter<7;jCounter++){
if(arrSymbol[i][j]<1){
printf(\"\\t.\");
}
elseif(arrSymbol[i][j] >= 1 && arrSymbol[i][j] < 5){
printf(\"\\t-\");
}
elseif(arrSymbol[i][j] >= 5 && arrSymbol[i][j] < 10){
printf(\"\\t+\");
}
elseif(arrSymbol[i][j] >= 10){
printf(\"\\t*\");
}
}
printf(\"\ \");
}
}