-
-
Save parzibyte/93ee6bfc15c78e1f2efeba86ac0c0a4e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Más arriba... | |
double fondos = 5000; // Simular fondos | |
//... | |
if (eleccion == "1") | |
{ | |
// Solicitar cuánto se retira | |
double retiro; | |
cout << "Ingrese cantidad a retirar: " << endl; | |
cin >> retiro; | |
// Comprobar si puede retirar | |
if (retiro > fondos || retiro <= 0) | |
{ | |
cout << "No puede retirar esa cantidad"; | |
} | |
else | |
{ | |
// En caso de que sí pueda retirar | |
cout << "OK. Ha retirado " << retiro << endl; | |
// Restamos los fondos existentes | |
fondos = fondos - retiro; | |
// Y el ciclo sigue... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment