-2
#include <stdio.h>
main()
{
float saldo, valor;
int opc;
printf("Entre com o saldo inicial da conta: ");
scanf("%f", &saldo);
while (opc != 4)
{
printf("\nBem vindo ao banco.\n");
printf("1 - Sacar\n");
printf("2 - Depositar\n");
printf("3 - Saldo\n");
printf("4 - Sair\n");
printf("Opcao: ");
scanf("%d", &opc);
}
switch (opc)
{
case 1:
printf("Valor a sacar: ");
scanf("%f", &valor);
saldo = saldo - valor;
break;
case 2:
printf("Valor que quer depositar: ");
scanf("%f", &valor);
saldo = saldo + valor;
break;
case 3:
printf("O saldo atual na conta e: %.2f reais.\n", saldo);
break;
case 4:
printf("\nSair\n");
break;
default:
break;
}
return 0;
}
//He should ask me how much I want to withdraw/deposit, but he keeps just returning me the list of options. For example: Sign in with the opening balance of the account: 1000 /This is from an earlier entry/ Welcome to the bank. 1 - Draw
2 - Deposit
3 - Balance
4 - Quit
Option: /And here he repeats again/