所以基本上我有一个数组,看起来像这样:C++字符数组查找/替换一个char
char array[25];
我有一个“X”摆在那里,和24“0'。我试图创建一个函数,我可以在数组中找到'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);
}
也许你需要[一个很好的入门书(HTTP://计算器.COM /问题/ 388242 /对,最终-C-书指南和列表)?因为它应该教会你自己解决问题的所有知识。 –
使用std :: string! – 2017-10-16 07:01:13