Put each input to cin in a loop, check to see if the input variable is negative, and prompt the user to re-enter the values if the input values are negative. I'm assuming this is homework, so that's really all I'm going to say.
and the user enters a non-number, the user causes the fail bit to be set for cin. In order to fix this you must first clear(), then ignore() everything in the buffer, and finally ask for the number again:
1 2 3 4 5 6 7 8 9 10 11 12
double d; // or int d
cout << "Please enter an integer: ";
while (!(cin >> d)) // while the extraction sets the fail bit
{
cin.clear();
cin.ignore(80, '\n');
cout << "Numbers only please, try again: ";
}
cin.ignore(80, '\n'); // ignore when the loop is finished too
if (d != static_cast<int>(d))
cout << "Hey, I asked for an integer!\n";