my code is going to take ten numbers and separate the numbers to two groups : odd and positive numbers
#include <iostream>
using namespace std;
int odd(int a)
{
if (a % 2 != 0)
{
return a;
}
}
int pos(int p)
{
if (p >= 0)
{
return p;
}
}
int main()
{
int i;
int entery[10];
cout << "please enter ten number : ";
for (i = 0; i < 10; i++)
{
cin >> entery[i];
}
cout << "the odd numbers are : \n" << odd(entery[i]);
cout << "your positive numbers are : \n" << pos(entery[i]);
}
it it somehow works but the odd number is always 0 and the positive number always is -858993460
I use it without array and both groups become zero