Hello you guys. Im doing this one homework assignment and i really need some help. My question is, How would you write an if statement that excludes the blank space and how would you write an if statement stating that its magenta when its inside the red space with the following guidelines. This is the problem:
In the grid below, each row/column intersection is a different color. Write an if-statement, possibly including many nested ifs and elses, to assign the right colors to each row and column. In your code, assume variables 'row' and 'col' give the row/col number. Based on the row/col values, assign one value into a char variable 'color', using the letter-abbreviations from the color legend below the grid. If row/col indicates a blank square, then assign no value at all (not even ' ') into 'color'. Don't declare the variables row, col, or color; assume they are already declared. Write just the if-statement described. You may use only as many ifs, elses, nots, ands, and ors as indicated, and may not use any #defines.
Use at most the indicated numbers of the following:
* 1 !'s
* 21 &&'s
* 4 else's
* 6 if's
* 5 ||'s
This is what ive done so far for the magenta part:
if ((col >= 19 && row < 16 & col >= 21 && row < 18 && col >= 25 && row < 22 && col < 27 && row < 12 && col < 29 && row >= 8) {
color = 'M';
}
else {
if ( col >= 18 && col < 30 && row >= 4 && row < 24)
color = 'R';
}
I know some statements dont make sense but thats why i need some help.
** see attached file ***