Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created September 9, 2022 16:47
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/d3c06ceb56098f27566d4202e0fe8094 to your computer and use it in GitHub Desktop.
Save parzibyte/d3c06ceb56098f27566d4202e0fe8094 to your computer and use it in GitHub Desktop.
int retirarDinero(struct NodoDeCliente *nodo, char *numeroCuenta, double cantidad)
{
while (nodo != NULL)
{
if (strcmp(nodo->numeroCuenta, numeroCuenta) == 0)
{
if (nodo->saldo >= cantidad)
{
nodo->saldo = nodo->saldo - cantidad;
return 1;
}
else
{
return 0;
}
}
nodo = nodo->siguiente;
}
return 0;
}
int depositarDinero(struct NodoDeCliente *nodo, char *numeroCuenta, double cantidad)
{
return retirarDinero(nodo, numeroCuenta, -cantidad);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment