Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

C++: Please help me figure out how to write a function in c++ for determining the color of a square on a chess board!!!! image text in transcribed
image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 33rd International Conference Dexa 2022 Vienna Austria August 22 24 2022 Proceedings Part 1 Lncs 13426

Authors: Christine Strauss ,Alfredo Cuzzocrea ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

3031124227, 978-3031124228

More Books

Students also viewed these Databases questions

Question

4. Does cultural aptitude impact ones emotional intelligence?

Answered: 1 week ago