Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

programando em python esse codigo em c

+2 votes
asked May 18, 2021 by paulo magalhaes (1,260 points)
Faça um programa que realiza o cadastro de contas bancárias com as seguintes informações: número da conta, nome do cliente e saldo. O banco permite o cadastramento de apenas quinze contas e não pode haver mais de uma conta com o mesmo número. Crie o menu de opções a seguir:

1 Cadastrar contas.

2 Visualizar todas as contas de determinado cliente.

3 Excluir a conta com menor saldo (Suponha a não existência de saldos iguais).

4 Sair.

#include <stdio.h>

#include <string.h>

#include <stdlib.h>

#define tam 15

main () {

       struct banco {

              int num_conta;

              char cliente [50];

              float saldo;

       };

       struct banco contas [15];

       int i, j, menu, ver_conta, contcliente = 0, cont = 0, numero;

       char vnome [50];

       while (menu! = 4) {

              printf ("\ t \ t * * * * * * * * * * * * * * * * * * * \ n");

              printf ("\ t \ t * CONTAS BANCARIAS * \ n");

              printf ("\ t \ t * * * * * * * * * * * * * * * * * * \ n");

              printf ("\ t \ t * Menu de opções * \ n");

              printf ("\ t \ t * * * * * * * * * * * * * * * * * * \ n");

              printf ("\ t \ t * [1] Cadastrar como Contas * \ n");

              printf ("\ t \ t * [2] Visualizar todas as contas * \ n");

              printf ("

              printf ("\ t \ t * [4] Sair * \ n");

              printf ("\ t \ t * * * * * * * * * * * * * * * * * * \ n"); menu = 0;

           printf ("\ n \ n \ t \ t MENU:");

               scanf ("\ t \ t% d", & menu);

               switch (menu) {

                       case 1:

                              printf ("\ n \ n");

                              do {

                                       printf ("\ t Digite o Numero da Conta:");

                                       scanf ("\ t% d", & ver_conta);

                                       para (i = 0; i <tam; i ++) {

                                            if (ver_conta! = contas [i].

                                                contcliente ++;

                                            }}

                                            if (contcliente == 15) {

                                                contas [cont] .num_conta = ver_conta;

                                                printf ("\ t Digite o Nome do Cliente:");

                                                scanf ("\ t% s", & contas [cont] .cliente);

                                                printf ("\ t Digite o saldo:");

                                                scanf ("\ t% f", & contas [cont] .saldo);

                                                printf ("\ n");

                                             }

                                             else {

                                                   cont = cont-1;

                                                   printf ("Conta existe \ n");

                                                   contcliente = 0;

                                                }

                                                cont ++;

                                        } enquanto (cont <15);

                                        pausa;

                        caso 2:

                               printf ("\ n \ n");

                               printf ("\ tDígito o nome do cliente:");

                               scanf ("\ t% s", & vnome);

                               para (i = 0; i <tam; i ++) {

                                     numero = (strcmp (vnome, contas [i] .cliente));

                                     if (numero == 0)

                                         printf ("\ n \ n \ tNumero Conta:% d - Nome:% s - Saldo:% f \ n", contas [i] .num_conta, contas [i] .cliente, contas [ i] .saldo);

                               }

                               pausa;

                        caso 3:

                               printf ("\ n \ n");

                               printf ("\ t Digite o Numero da Conta:");

                               scanf ("\ t% d", & ver_conta);

                               for (i = 0; i <tam; i ++) {

                                    if (ver_conta == contas [i] .num_conta) {

                                        printf ("\ n \ n \ tNumero Conta:% d - Nome:% s - Saldo:% f \ n ", contas [i] .num_conta, contas [i] .cliente, contas [i] .saldo);

                                    }

                               }

                                pausa;

                        caso 4:

                               quebra;

                        padrão:

                               printf ("OPCAO INVALIDA");

                                                   }

                }

                getch ();

      }

1 Answer

0 votes
answered 2 days ago by Sam (370 points)
this isn't python
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...