total = 0;
cin >> amount;
while (amount >= 0) 
{
  total += amount;
  cin >> amount;
}