error c2664: I am having problem with my code

Posted on 2011-03-13
Last Modified: 2012-05-11
Hi, I am having trouble with my code.

Could you please tell me why it doesn't compile?

Thanks a lot.

using namespace std;
const int N=6;

void ReadData(int x[]);
void Display (int x[]);
float FindAve(int x[]);
void DisplayAbove(int x[], float);
void FindMaxMin(int x[], int& max, int& min);

int main(){
	int a[N];
	//read data into array a
	//Display array a
	//find and display the average of numbers of array a
		float Average=FindAve(a);
		cout<<"Average= "<<fixed<<setprecision(2)<<Average<<endl;
	//Display data numbers whose value is >= average
	//find and display the maximum and minimum numbers in array a
		int man, min;
		cout<<"The maximum data is "<<max<<endl;
		cout<<"The minimum data is "<<min<<endl;
	//terminate program
		return 0;
//Input:numbers entered by the user
//Output:numbers stored in the array a
void ReadData(int x[])
{cout<<"Enter 6 integer numbers: ";
for( int i=0; i<N; ++i)
//Input:array a
//Output:display the content of the array
void Display(int x[])
{cout<<"This is the content of the array a: ";
for(int i =0;i<N;++i)
cout<<x[i]<<' ';
//Input:the array numbers
//Output:their average
float FindAve(int x[])
{float sum=0.0;
for(int i=0;i<N;++i)
return sum/N;
//Input:array a and the average of the array
//Output:the numbers from the array which are above the average of the array
void DisplayAbove(int x[],float a)
{cout<<"This is the list of data whose values are above the average: ";
	for(int i=0;i<N;++i)
	{if (x[i]> a) cout<<x[i]<<' ';}
//Input:array a
//Output:the max and min number from the array
void FindMaxMin(int x[],int& max, int& min)
for(int i=1;i<N;++i)
	{if(x[i]>max) max=x[i];
	if(x[i]<min) min=x[i];

Input: enter 22 33 44 11 88 77

Open in new window

Question by:pgmerLA
LVL 35

Accepted Solution

mccarl earned 500 total points
ID: 35124219
At first glance, on line 25 you have defined a variable called man (instead of max)

Author Comment

ID: 35124277
Thanks a lot. I had been staring at the code for too long.
It works now.

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now