Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Last active January 16, 2021 19:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/93ee6bfc15c78e1f2efeba86ac0c0a4e to your computer and use it in GitHub Desktop.
Save parzibyte/93ee6bfc15c78e1f2efeba86ac0c0a4e to your computer and use it in GitHub Desktop.
// 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