我正在尝试创建一个充当rubik多维数据集的程序。我创建了多维数组作为rubik立方体的一行(4 * 3)。
我正在尝试创建一个函数来旋转其中一个数组左侧切换[3] [0]到[2] [0]和[2] [0]到[1] [0]。 ..etc,我收到此错误,需要帮助修复它。
#include <iostream>
using namespace std;
char rLeft(char* const rArray,int rows,int colms);
//~~~~~~~~~~~~~~~~~~~~~~~~Left,~~~~~~~~Center,~~~~~~~~Right,~~~~~~~~Back~~~~~~~//
char rI [4][3] = {{'r','r','r'},{'b','b','b'},{'o','o','o'},{'g','g','g'}};
char rII [4][3] = {{'r','r','r'},{'b','b','b'},{'o','o','o'},{'g','g','g'}};
char rIII [4][3] = {{'r','r','r'},{'b','b','b'},{'o','o','o'},{'g','g','g'}};
char cI [4][3] = {{'w','w','w'},{'r','r','r'},{'y','y','y'},{'o','o','o'}};
char cII [4][3] = {{'w','w','w'},{'r','r','r'},{'y','y','y'},{'o','o','o'}};
char cIII [4][3] = {{'w','w','w'},{'r','r','r'},{'y','y','y'},{'o','o','o'}};
int main()
{
cout << "Hello World!" <<endl;
rLeft(rI,4,3);
return 0;
}
char rLeft(int rArray[4][3], int rows, int colms);
{
rows = 0;
colms = 0;
for (i = 0, i < rows, i++)
{
for (ii = 0, ii < colms, ii++)
{
if (rows != 3)
{
rArray[rows][colms] = rArray[rows+1][colms]
return rArray[row][colms];
}
else
{
rArray[rows][colms] = rArray[0][colms]
return rArray[row][colms];
}
}
}
}
答案 0 :(得分:0)
嗯,显然你的第一个功能声明与第二个不同。然后做同样的事情:
char rLeft(int rArray[4][3], int rows, int colms);
您还需要从函数定义中删除分号:
char rLeft(int rArray[4][3], int rows, int colms)
// ^^^^^ (no semicolon)
{
// ...