日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > C# >内容正文

C#

c#象棋程序_C ++程序确定象棋方块的颜色

發布時間:2025/3/11 C# 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 c#象棋程序_C ++程序确定象棋方块的颜色 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

c#象棋程序

A chess board is equally divided into 64 identical squares that are black and white alternately. Each square on the chessboard can be identified by the coordinates as 'A' to 'H' on the horizontal axis and '1' to '8' on the vertical axis as shown in the figure.

一塊國際象棋棋盤平均分為64個相同的正方形,它們是黑白交替的 。 如圖所示,可以通過在水平軸上的坐標從“ A”到“ H”以及在垂直軸上的“ 1”到“ 8”來標識棋盤上的每個正方形。

Each square can be identified using the coordinate system specified above. For example, the square with coordinates G5 is colored Black, A6 is colored White and so on...

可以使用上面指定的坐標系來標識每個正方形。 例如, 坐標為G5的正方形為黑色 , A6為白色 ,依此類推...

A program to identify the color of a specified square is given below.

下面給出識別指定正方形顏色的程序。

在C ++中確定國際象棋方板的顏色 (Determine the color of a chess square board in C++)

#include<iostream> #include<cctype> using namespace std;int main() {char string[10], x;cout << "Enter the coordinates of the square, \\nthe first coordinate A to H and second coordinate 1 to 8: ";cin.getline(string, 10);x = string[0];x = tolower(x);string[0] = x;if (string[0] == 'a' || string[0] == 'c' || string[0] == 'e' || string[0] == 'g'){if (string[1] == '1' || string[1] == '3' || string[1] == '5' || string[1] == '7')cout << "Black square";elsecout << "White square";}else{if (string[1] == '1' || string[1] == '3' || string[1] == '5' || string[1] == '7')cout << "white square";elsecout << "Black square";}return 0; }

Output

輸出量

First run: Enter the coordinates of the square, the first coordinate A to H and second coordinate 1 to 8: C5 Black squareSeccond run: Enter the coordinates of the square, the first coordinate A to H and second coordinate 1 to 8: F3 white square

翻譯自: https://www.includehelp.com/cpp-programs/determine-the-color-of-chess-square.aspx

c#象棋程序

總結

以上是生活随笔為你收集整理的c#象棋程序_C ++程序确定象棋方块的颜色的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。