c++初学者,有个问题困扰小弟很久,求能人解答一下

weixin_41865657 weixin_41865657 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
源代码如下:
#include <iostream>

using namespace std;
int MAX(int x);
int main(int argc, char *argv[]) {
int n = 0; int a;int sum = 0; int i = 0;
" how many numbers do you want to input? please input: ";
cin>>n;
if(n>0&&n<=100)
{
cout<<"please input";
while(i<=n)
{
cin>>a;
cout<<" ";
sum += a;
max = MAX(a)
i += 1;

}
cout<<sum<<endl<<max;



}
else
cout<<"your input is wrong";

}

int MAX(int x)
{
int max = 0;

{
if(x>max)
max = x;
else
max = max;

}
return max;

}

提示的error:
error: reference to overloaded function could not be resolved; did you mean to call it?
max = MAX(a)
^~~
error: reference to overloaded function could not be resolved; did you mean to call it?
cout<<sum<<endl<<max;
^~~

真多不知道哪错了,能为小弟解答的话将十分感谢
...全文

相关推荐

评论 9
收藏 已收藏
分享
返回顶部
weixin_41865657
新手乐园 33,315 成员 41,769 内容