代码运行的时候出现了 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),即倒数第二行处提示错误,为什么会出现这种类型的错误呢?
cout << count(apples, plates);
count << count(apples, plates);
The left side is the function<<The right side is the int type
Is this possible?
First tell me the reason why you use it this way
Sorry, I changed cout to count