Question: C++: Please help me figure out how to write a function in c++ for determining the color of a square on a chess board!!!! Problem
Problem 4 (10 points): chessBoard Each square on a chess board can be described by a letter and number, such as g5 in this example a b cdef g h 6 5 2 a2 b2 c2 d2 2 Write a function chessBoard which determines if a square with a given letter or number on a chessboard, is dark (black) or light (white). Your function MUST be named chessBoard Your function takes two input arguments: a character, and an integer . . If your function receives as input a valid character and number, then it must print either "black" or "white", depending on the color of the square given by those coordinates. (Note: the darker squares on the example board above should be considered as black and the lighter squares should be considered as white; non-white/black is used to distinguish between text, pieces and squares.) If your function receives as input anything other than a-h for character, and 1-8 for number, then it must print "Chessboard squares can only have letters between a-h and numbers between 1-8." Note that your function should discern between the valid lowercase letters and the invalid uppercase ones. Your function should NOT return anything. . Examples If the input arguments are ('g', 5), the functidh should print black . If the input arguments are ("c, 4), the function should print white . If the input arguments are ('a', 1), the function should print black .If the input arguments are ('A', 10), the function should print Chessboard squares can only have letters between a-h and numbers between 1-8
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
