fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. double withdrew;
  6. cout << "How much did you withdraw this month? ";
  7. cin >> withdrew;
  8. while (withdrew < 0) {
  9. cout << "Invalid amount! Please enter a positive withdrawal: ";
  10. cin >> withdrew;
  11. } return 0;
  12. }
Success #stdin #stdout 0s 5216KB
stdin
-2
-9
2
stdout
How much did you withdraw this month? Invalid amount! Please enter a positive withdrawal: Invalid amount! Please enter a positive withdrawal: