The function I have written is an attempt to return true if all elements in an array are positive and false otherwise. When I run it it keeps running it as true even though I have one negative number in the array. And depending on what code adjustments I make I get a warning that says:
I know it has something to do with me not setting up a condition if an array element happens to be negative but i thought the return false if not true statement took care of that. Any help is always appreciated.
warning C4715: 'pos' : not all control paths return a value
using namespace std;
bool pos(int a,int size );//prototype
const int size=10;
cout<<"All elements in array are positive";
bool pos(int a, int size) //print number of even elements