为什么会出现 invalid operands 的问题?

代码运行的时候出现了 invalid operands of types 'int (int, int)' and 'int' to binary 'operator<< ' 的错误。
代码如下:

//把M个同样的苹果放在N个同样的盘子里,允许有盘子空着,一共有几种放法?
#include <iostream>

using namespace std;

int count(int m, int n)
{
    if (m <=1 || n <=0) return 1;
    if (m < n)
        return count(m, m);
    else
        return count(m, n-1)+count(m-n, n);
}

void prime()
{
    int apples, plates;
    cin >> apples >> plates;
    count << count(apples, plates);
}

在count<< count(apples, plates),即倒数第二行处提示错误,为什么会出现这种类型的错误呢?

阅读 11.2k
4 个回答

cout << count(apples, plates);

count << count(apples, plates);
左边是函数<<右边是int类型

这也能行?

你先说说你这么用的理由

新手上路,请多包涵

不好意思,我把cout打成count了

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题