【发布时间】:2018-03-27 15:00:38
【问题描述】:
所以基本上我有一个如下所示的数组:
char array[25];
我有一个“X”和 24 个“O”。我正在尝试创建一个函数,我可以在其中找到“X”在数组中的位置,这样我就可以在输入控件时移动它。这里有一些代码可以让我了解我的想法,我只是不能放在一起。
int findX(){
//make this find the location of X out of the 25 char array.
//then return the slot of X as a number, like if it's in the 20th slot, then it will return 20 ?
//return(locationOfX);
}
【问题讨论】:
-
也许你需要a good beginners book?因为它应该教会你自己解决问题所需要知道的一切。
-
使用 std::string!