i couldnt compile this fuction what is wrong???

/*To find how many smilar numbers in array and which is it and
To find sum of numbers in array by using functions*/

#include<iostream>
int findsmilarnumbers ( int number[], int count )
{
int result = 0;
for ( int i=0; i<count; i++ )
{
for ( int j=0; j<count; j++ )
{
if (numbers[i] == numbers[i]&& ( i != j ))
{
result ++;
}
}
return result;
}
int sum ( int numbers[], int count )
{
int result = 0;
for ( int i=0; i<count; i++ )
{
result = numbers[i];
}
return result;
}
void man()
}

int main ()
{
int a[4] = {1,2,2,3};
int count = 4;
int smilarnumber = findsmilarnumbers( a, count );
int sum = sum( a, count );
cout <<" smilar numbers count "<< smilarnumber;
cout <<" sum of numbers "<< sum;
return 0;
}
First:
You need to do one of the following:
Place "using namespace std;" (without quotes) or use "std::cout" instead of just plain "cout".
Second:
TYPING ERRORZ. In "findsmilarnumbers()" you declared "number" and tried to use "numbers". Compiler = picky.
Third:
You need another closing brace on line 18.
Fourth:
Remove "void man()". What is it there for anyway?
Fifth:
Rename "int sum" in your main function and wherever you use the variable. The compiler gets confused as hell and throws an error.
Sixth:
It's a program, not a function. ;)
Last edited on
Topic archived. No new replies allowed.