【发布时间】:2017-11-24 22:38:51
【问题描述】:
在下面的代码中,在我递归调用函数的所有行中,我都会收到此错误:
[错误] 表达式列表在初始化程序 [-fpermissive] 中被视为复合表达式
我认为这与我没有放入变量类型有关, 但是当我这样做时,我得到了另一个错误,声称它需要在 '+' 或 '-' 前面有一个 ',' 或 '...'。
#include <iostream>
#include <vector>
using namespace std;
int lastmove = 0;
// Returns true if you can reach the bottom-right (otherwise returns false).
// You can move up, down, left, or right. You cannot move diagonally.
// 1 represents a wall. You cannot go through a wall.
bool winnable(int maze[5][5], int m, int n) {
// Testing moves in right, down, left and up directions
// If the previous move is the opposite vertically or horizontally
// It is not valid
if (n<6&& maze[m][++n]!=1 && lastmove!=3){
if(m==5&&n==5)
return true;
lastmove = 1;
bool winnable(maze, m, ++n);
【问题讨论】:
-
在此处丢失
bool:bool winnable(maze, m, ++n);或更好地将返回值分配给某些东西。并贴出所有代码。
标签: c++