I hope it helps:
int userInput()
{
int a = 0;
while(a <= 0) {
cout << "Enter value greater than zero: " << endl;
cin >> a ;
if(a <= 0)
cout << "Input incorrect. Please try again " << endl;
}
return a;
}