adding random numbers using & function?

When i compile it come up with an error that says that control reaches end of
non-void function why isn't it working.
#include <iostream>
#include <ctime>
#include <cstdlib>
using namespace std;
//int even(int &m);
//int odd(int &n);

int main()
{
int x,sum1, sum2;
srand(time(0));
for (int i=0; i< 10; i++)
{
x=1+ rand() % 10;
cout << " "<< x;
sum1 += even(x);
sum2 += odd(x);
}
cout <<endl;
cout << "sum of the even is "<<sum1<<endl;
cout << "Sum of the odd is "<<sum2<<endl;


return 0;
}

int odd(int &n)
{
if (n %2!=0)
return n;
}

int even(int &m)
{
if (m%2==0)
return m;
}
What do you think the odd function returns if n is even?
What do you think the even function returns if m is odd?
the function checks if their even or odd then it should return the number back and add it.
okay now it works thanks. but the odd number is giving me a huge number like 7 million
big~7541321
Topic archived. No new replies allowed.