c++初学者,有个问题困扰小弟很久,求能人解答一下
源代码如下:
#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;
^~~
真多不知道哪错了,能为小弟解答的话将十分感谢
#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;
^~~
真多不知道哪错了,能为小弟解答的话将十分感谢
...全文
相关推荐
C++常见问题解答
C++支持OOP的核心特性,如类、对象、继承、多态等。以上是C++常见问题解答的引言篇内容,接下来我们将继续探讨基础篇中涉及的知识点。
《c++程序设计》 解答
在提供的压缩包文件中,3.cpp、1.cpp、2.cpp、7.cpp和8.cpp可能是针对第十一章各节问题的解答示例代码。
C++ Primer Plus(第五版)习题解答和例题代码
cpp5sol"文件夹则可能包含对应习题的参考答案或解题思路,对于初学者来说,对照答案可以检查自己的解答是否正确,理解解题思路则有助于深化对C++语言机制的理解。
C++问题解答
由于其复杂性和灵活性,初学者和经验丰富的开发者都可能会遇到各种挑战。以下是一些常见的C++问题及其解答,旨在帮助你更好地理解和解决问题。1.
编程及C/C++初学者 FAQ
### 编程及C/C++初学者 FAQ#### 一、引言本文档旨在帮助初学者快速上手C/C++编程语言,并解答在学习过程中可能遇到的各种常见问题。


新手乐园
