Caixa eletrônico em C

Script que simula um caixa eletrônico em linguagem C. O usuário informa o valor a ser sacado e o programa informa a quantidade de notas de cada valor necessárias para formar o valor do saque.

Utiliza notas de 100, 50, 20, 10, 5, 2, 1.

/*
Desenvolvido por Angelito M. Goulart
ange.sap@hotmail.com

http://twitter.com/angelitomg

http://angelitomg.wordpress.com

*/
#include <stdio.h>
int valor, n100=0, n50=0, n20=0, n10=0, n5=0, n2=0, n1=0;
int main()
{
printf (“Digite o valor a ser sacado: “);
scanf (“%d”, &valor);
if (valor>=0)
{
verifica();
}
else
{
main();
}
}
verifica()
{
if (valor>=100)
{
v100();
}
if (valor>=50 && valor<100)
{
v50();
}
if (valor>=20)
{
v20();
}
if (valor>=10)
{
v10();
}
if (valor>=2)
{
v2();
}
if (valor==1)
{
v1();
}
}
v100()
{
while (valor>=100)
{
valor = valor-100;
n100++;
}
v50();
}
v50()
{
while (valor>=50)
{
valor = valor-50;
n50++;
}
v20();
}
v20()
{
while (valor>=20)
{
valor = valor-20;
n20++;
}
v10();
}
v10()
{
while (valor>=10)
{
valor = valor-10;
n10++;
}
v5();
}
v5()
{
while (valor>=5)
{
valor = valor-5;
n5++;
}
v2();
}
v2()
{
while (valor>=2)
{
valor = valor-2;
n2++;
}
v1();
}
v1()
{
while (valor>=1)
{
valor = valor-1;
n1++;
}
printf (“Notas de 100: %d \n”, n100);
printf (“Notas de  50: %d \n”,  n50);
printf (“Notas de  20: %d \n”, n20);
printf (“Notas de  10: %d \n”, n10);
printf (“Notas de   5: %d \n”, n5);
printf (“Notas de   2: %d \n”, n2);
printf (“Notas de   1: %d \n”, n1);
}

Abraço a todos.

Tags: , ,

13 Respostas para “Caixa eletrônico em C”

  1. Wesley Simões Disse:

    Opa Angelito, beleza? Dei uma olhada na tua calculadora em C, tive que fazer algo parecido ano passado na faculdade =P
    Parabéns pelo trabalho…
    Então, afim de trocar uns links ae?
    Coloca o meu ae nos teus links que eu coloco o teu aqui.
    Qualquer coisa, só gritar;
    Valeu…fui!

  2. Alan Wink Disse:

    Que programa tu usa pra compilar Angelito???

  3. Angelito Disse:

    Olá Alan, tudo tranquilinho? Eu utilizo o gcc para compilar. No Linux, na maioria das distribuições ele já vem instalado e no Windows, baixe o Dev-C++.

    Dev-C++ -> http://www.baixaki.com.br/download/dev-c-.htm

    Abração

  4. Compilando programas feitos em C « Blog do Angelito Disse:

    [...] dias, postei um script que simulava um caixa eletronico, feito utilizando a linguagem C. Porém, o leitor e amigo Alan Wink enviou um comentário [...]

  5. Fernando Amado Disse:

    Criei um programa do tipo caixa eletrônico em C recentemente, pensei em tudo o que um caixa eletrônico tem: extratos, empréstimos com juros, saques, depósitos etc. Como estou iniciando agora, meu programa ficou muito grande porem ficou muito bom. Segue abaixo o código…

    /***************************************************************************************/
    /*Programa Dispenser – Simula um caixa eletrônico, é possivel fazer depositos e saques.*/
    /***************************************************************************************/
    #include
    #include
    #include
    #include
    #include
    void sair();
    void histograma(int loading);
    void acumulaSaq(int);
    void acumulaDep(int);
    void acumulaEmp(int);
    void acumulaN100Dep(short);
    void acumulaN50Dep(short);
    void acumulaN20Dep(short);
    void acumulaN10Dep(short);
    void acumulaN5Dep(short);
    void acumulaN2Dep(short);
    void acumulaN1Dep(short);
    void acumulaN100Saq(short);
    void acumulaN50Saq(short);
    void acumulaN20Saq(short);
    void acumulaN10Saq(short);
    void acumulaN5Saq(short);
    void acumulaN2Saq(short);
    void acumulaN1Saq(short);
    void notasDisponiveis();
    void saldoExtrato();
    int verificaDepCheque();
    int loadingFile();
    int verificaDep();
    int verificaSaq();
    int emprestimo();
    int deposito();
    int cliente();
    int saque();
    int senha();
    int main();
    int v100();
    int v50();
    int v20();
    int v10();
    int v5();
    int v2();
    int v1();
    int w100();
    int w50();
    int w20();
    int w10();
    int w5();
    int w2();
    int w1();
    struct tm *DataAtual; //estrutura para armazenar data e hora.
    short perg=0, asteriscos=0, incremento=0;
    float saldo=0, totalEmp=0, totalSaq=0, totalDep=0, juros=0.08;
    short valorDep=0, valorDepCheque=0, n100=0, n50=0, n20=0, n10=0, n5=0, n2=0, n1=0;
    short valorSaq=0, valorEmp=0, s100=0, s50=0, s20=0, s10=0, s5=0, s2=0, s1=0;
    short notas100Dep=0, notas50Dep=0, notas20Dep=0, notas10Dep=0, notas5Dep=0, notas2Dep=0, notas1Dep=0;
    short notas100Saq=0, notas50Saq=0, notas20Saq=0, notas10Saq=0, notas5Saq=0, notas2Saq=0, notas1Saq=0;
    int contaCorrente() { // Função que solicita número de conta corrente, que é ’1234′
    char contaCliente[5]=”1234″;
    char conta[5];
    short validaConta;
    system(“cls”);
    printf(“*****************************************************”);
    printf(“\n*************** CAIXA ELETRONICO S/A ****************”);
    printf(“\n*****************************************************”);
    printf(“\n*\t\t\t\t\t\t *\n*\t\t SEJA BEM VINDO\t\t *\n”);
    printf(“**** SIGA AS INSTRUCOES PARA UTILIZACAO DO CAIXA ****\n”);
    printf(“\nDIGITE SUA CONTA CORRENTE: “);
    scanf(“%s”, &conta);
    validaConta = strcmp (contaCliente, conta);
    if (validaConta == 0)
    senha();
    else
    printf(“CONTA INCORRETA\n\n”);
    system(“pause”);
    contaCorrente();
    }
    int senha() { // Função que solicita senha, que é ’1234′
    char senhaCliente[] = “1234″;
    char senha[4];
    short validaSenha;
    printf(“\nDIGITE SUA SENHA: “);
    for(asteriscos = 0; asteriscos tm_mday, DataAtual->tm_mon+1,DataAtual->tm_year+1900);
    printf(“* HORARIO ATUAL: %02d:%02d:%02d \t\t\t *”, DataAtual->tm_hour, DataAtual->tm_min, DataAtual->tm_sec);
    printf(“\n*\t\t\t\t\t\t *\n**O CAIXA ELETRONICO S/A AGRADECE A SUA PREFERENCIA!**\n\n”);

    if (DataAtual->tm_hour >= 00 && DataAtual->tm_hour tm_hour >= 13 && DataAtual->tm_hour tm_hour >= 19 && DataAtual->tm_hour tm_hour >= 6 && DataAtual->tm_hour =0 && valorSaq<=1000) {
    if(valorSaqtm_hour >= 22 || DataAtual->tm_hour >= 00 && DataAtual->tm_hour =0 && valorSaq<=600) {
    if(valorSaqtm_hour >= 6 && DataAtual->tm_hour 1000) {
    printf(“\n\t\t\t*ATENCAO*\nVALOR ACIMA DE R$ 1.000,00 – EXCEDEU SEU LIMITE DE SAQUE,\n”);
    printf(“COMPARECA A SUA AGENCIA PARA SACAR JUNTO AO SEU GERENTE!\n\n”);
    system(“pause”);
    saque();
    }
    }
    if (DataAtual->tm_hour >= 22 || DataAtual->tm_hour >= 00 && DataAtual->tm_hour 600) {
    printf(“\n\t\t *ATENCAO*\nLIMITE DE SAQUE DE R$ 600,00 DAS 22:00HS AS 05:59HS\n”);
    printf(“HORARIO ATUAL: %02d:%02d:%02d\n\n”, DataAtual->tm_hour, DataAtual->tm_min, DataAtual->tm_sec);
    system(“pause”);
    saque();
    }
    }
    if (DataAtual->tm_hour >= 00 && DataAtual->tm_hour saldo) {
    printf(“\n\t\t\t *ATENCAO*\n\t\t SALDO INDISPONIVEL\n\t\tVALOR DE SEU SALDO: R$ %.2f\n\n”, saldo);
    system(“pause”);
    saque();
    }
    }
    }
    int verificaSaq() { // função que verifica as notas disponiveis para apresentar ao cliente

    if (valorSaq>=100) {
    w100();
    }
    if (valorSaq>=50) {
    w50();
    }
    if (valorSaq>=20) {
    w20();
    }
    if (valorSaq>=10) {
    w10();
    }
    if (valorSaq>=5) {
    w5();
    }
    if (valorSaq>=2) {
    w2();
    }
    if (valorSaq==1) {
    w1();
    }
    }
    int w100() { // Função que verifica quais serão as notas a serem apresentadas ao cliente
    while (valorSaq>=100) { // e logo em seguida gravadas no acumulaN100Saq de acordo com a quantidade
    s100=(valorSaq/100);
    valorSaq=valorSaq-(s100*100);
    acumulaN100Saq(s100);
    printf (“\nNOTAS DE R$ 100,00:…………………%d NOTAS\n”, s100);
    }
    w50();
    }
    int w50() {
    while (valorSaq>=50) {
    s50=(valorSaq/50);
    valorSaq=valorSaq-(s50*50);
    acumulaN50Saq(s50);
    printf (“\nNOTAS DE R$ 50,00:…………………%d NOTAS\n”, s50);
    }
    w20();
    }
    int w20() {
    while (valorSaq>=20) {
    s20=(valorSaq/20);
    valorSaq=valorSaq-(s20*20);
    acumulaN20Saq(s20);
    printf (“\nNOTAS DE R$ 20,00:…………………%d NOTAS\n”, s20);
    }
    w10();
    }
    int w10() {
    while (valorSaq>=10) {
    s10=(valorSaq/10);
    valorSaq=valorSaq-(s10*10);
    acumulaN10Saq(s10);
    printf (“\nNOTAS DE R$ 10,00:…………………%d NOTAS\n”, s10);
    }
    w5();
    }
    int w5() {
    while (valorSaq>=5) {
    s5=(valorSaq/5);
    valorSaq=valorSaq-(s5*5);
    acumulaN5Saq(s5);
    printf (“\nNOTAS DE R$ 5,00:…………………%d NOTAS\n”, s5);
    }
    w2();
    }
    int w2() {
    while (valorSaq>=2) {
    s2=(valorSaq/2);
    valorSaq=valorSaq-(s2*2);
    acumulaN2Saq(s2);
    printf (“\nNOTAS DE R$ 2,00:…………………%d NOTAS\n”, s2);
    }
    w1();
    }
    int w1() {
    while (valorSaq>=1) {
    s1=(valorSaq/1);
    valorSaq=valorSaq-(s1*1);
    acumulaN1Saq(s1);
    printf (“\nNOTAS DE R$ 1,00:…………………%d NOTAS\n”, s1);
    }
    printf(“\nPARA VOLTAR A TELA PRINCIPAL…….5\n”);
    printf(“PARA SAIR DIGITE……………….0\n\n”);
    printf(“DIGITE AQUI: “);
    scanf(“%d”, &perg);
    if (perg == 5)
    cliente();
    if (perg == 0)
    sair();
    else
    printf(“ATENCAO DIGITE CORRETAMENTE\n”);
    w1();
    }
    void acumulaSaq(int valorSaq) { // Acumulador de Saques
    totalSaq += valorSaq;
    }
    int deposito() { // Função que recebe valores para deposito
    system(“cls”);
    printf(“*****************************************************”);
    printf(“\n*************** CAIXA ELETRONICO S/A ****************”);
    printf(“\n*****************************************************”);
    printf(“\n*\t\t\t\t\t\t *\n*\t VOCE ESTA NA TELA DEPOSITO\t\t *\n”);
    printf(“*\t\t *ATENCAO*\t\t\t *\n”);
    printf(“* DIGITE SONENTE VALORES INTEIROS *\n”);
    printf(“**** SIGA AS INSTRUCOES PARA UTILIZACAO DO CAIXA ****\n\n”);
    printf (“DEPOSITO SERA FEITO DE QUE FORMA:\n\n”);
    printf (“1 – EM DINHEIRO\n\n”);
    printf (“2 – EM CHEQUE\n\n”);
    printf (“DIGITE AQUI: “);
    scanf(“%d”, &perg);
    if (perg==1) {
    printf (“\nDIGITE O VALOR DO DEPOSITO: R$ “);
    scanf (“%d”, &valorDep); // coloquei essa matemática para que o cálculo seja feito na hora,
    saldo = totalDep-(totalSaq+totalEmp+(totalEmp*juros)); // pois ela só é chamada no ‘saldoExtrato’ que esta mais a baixo-
    system (“cls”); // do código, se o cliente não a chamar o valor não é calculado.
    if (valorDep>0) { // Caso o valor seja maior que 0 o valor será gravado no acumulaDep
    acumulaDep(valorDep);
    loadingFile();
    verificaDep();
    }
    if (valorDep==0) {
    cliente();
    }
    else {
    deposito();
    }
    }
    if (perg==2) {
    printf (“\nDIGITE O VALOR DO CHEQUE: R$ “);
    scanf (“%d”, &valorDepCheque); // coloquei essa matemática para que o cálculo seja feito na hora,
    saldo = totalDep-(totalSaq+totalEmp+(totalEmp*juros)); // pois ela só é chamada no ‘saldoExtrato’ que esta mais a baixo-
    system (“cls”); // do código, se o cliente não a chamar o valor não é calculado.
    if (valorDepCheque>0) { // caso o valor seja maior que 0 o valor será gravado no acumulaDep
    acumulaDep(valorDepCheque);
    loadingFile();
    verificaDepCheque();
    }
    if (valorDepCheque==0) {
    cliente();
    }
    else {
    deposito();
    }
    }
    else {
    printf(“\n *ATENCAO*\n DIGITE 1 OU 2\n\n”);
    system(“pause”);
    deposito();
    }
    }
    int verificaDepCheque() {
    time_t Segundos;
    time(&Segundos); //obtém a hora em segundos.
    DataAtual = localtime(&Segundos); //converte horas em segundos.
    printf(“*****************************************************”);
    printf(“\n*************** CAIXA ELETRONICO S/A ****************”);
    printf(“\n*****************************************************\n”);
    printf(“* HORA: %02d:%02d:%02d \t\t\t\t *”, DataAtual->tm_hour, DataAtual->tm_min, DataAtual->tm_sec);
    printf(“\n* DATA: %02d/%02d/%04d \t\t\t\t *\n”, DataAtual->tm_mday, DataAtual->tm_mon+1,DataAtual->tm_year+1900);
    printf(“* AGENCIA: 0458-3\t CONTA CORRENTE: 1234 *\n*\t\t\t\t\t\t *\n”);
    printf(“***** FAVORECIDO: FERNANDO AMADO DA CONCEICAO *******\n\n”);
    printf (“VALOR DO DEPOSITO: R$ %d,00\t\n\n”, valorDepCheque);
    printf(“\nPARA VOLTAR A TELA PRINCIPAL…….5\n”);
    printf(“PARA SAIR DIGITE……………….0\n\n”);
    printf(“DIGITE AQUI: “);
    scanf(“%d”, &perg);
    if (perg == 5)
    cliente();
    if (perg == 0)
    sair();
    else
    printf(“ATENCAO DIGITE CORRETAMENTE\n”);
    verificaDepCheque();
    }
    void histograma (int loading) { // Função loading apresenta a tela deposito sendo carregada
    for (incremento=0; incremento < loading; incremento++) {
    printf("\xDB");
    }
    }
    int loadingFile() { // Função que efetua loading logo após o valor ser confirmado, trazendo nome e conta de favorecido
    for (incremento=0; incremento tm_hour, DataAtual->tm_min, DataAtual->tm_sec);
    printf(“\n* DATA: %02d/%02d/%04d \t\t\t\t *\n”, DataAtual->tm_mday, DataAtual->tm_mon+1,DataAtual->tm_year+1900);
    printf(“* AGENCIA: 0458-3\t CONTA CORRENTE: 1234 *\n*\t\t\t\t\t\t *\n”);
    printf(“***** FAVORECIDO: FERNANDO AMADO DA CONCEICAO *******\n\n”);
    printf (“VALOR DO DEPOSITO: R$ %d,00\t\n”, valorDep);

    if (valorDep>=100) {
    v100();
    }
    if (valorDep>=50) {
    v50();
    }
    if (valorDep>=20) {
    v20();
    }
    if (valorDep>=10) {
    v10();
    }
    if (valorDep>=5) {
    v5();
    }
    if (valorDep>=2) {
    v2();
    }
    if (valorDep==1) {
    v1();
    }
    }
    int v100() {
    while (valorDep>=100) { // Função que verifica quais serão as notas a serem apresentadas ao cliente
    n100=(valorDep/100); // e logo em seguida gravadas no acumulaN100Dep de acordo com a quantidade
    valorDep=valorDep-(n100*100);
    acumulaN100Dep(n100);
    printf (“\nNOTAS DE R$ 100,00:…………………%d NOTAS\n”, n100);
    }
    v50();
    }
    int v50() {
    while (valorDep>=50) {
    n50=(valorDep/50);
    valorDep=valorDep-(n50*50);
    acumulaN50Dep(n50);
    printf (“\nNOTAS DE R$ 50,00:…………………%d NOTAS\n”, n50);
    }
    v20();
    }
    int v20() {
    while (valorDep>=20) {
    n20=(valorDep/20);
    valorDep=valorDep-(n20*20);
    acumulaN20Dep(n20);
    printf (“\nNOTAS DE R$ 20,00:…………………%d NOTAS\n”, n20);
    }
    v10();
    }
    int v10() {
    while (valorDep>=10) {
    n10=(valorDep/10);
    valorDep=valorDep-(n10*10);
    acumulaN10Dep(n10);
    printf (“\nNOTAS DE R$ 10,00:…………………%d NOTAS\n”, n10);
    }
    v5();
    }
    int v5() {
    while (valorDep>=5) {
    n5=(valorDep/5);
    valorDep=valorDep-(n5*5);
    acumulaN5Dep(n5);
    printf (“\nNOTAS DE R$ 5,00:…………………%d NOTAS\n”, n5);
    }
    v2();
    }
    int v2() {
    while (valorDep>=2) {
    n2=(valorDep/2);
    valorDep=valorDep-(n2*2);
    acumulaN2Dep(n2);
    printf (“\nNOTAS DE R$ 2,00:…………………%d NOTAS\n”, n2);
    }
    v1();
    }
    int v1() {
    while (valorDep>=1) {
    n1=(valorDep/1);
    valorDep=valorDep-(n1*1);
    acumulaN1Dep(n1);
    printf (“\nNOTAS DE R$ 1,00:…………………%d NOTAS\n”, n1);
    }
    printf(“\nPARA VOLTAR A TELA PRINCIPAL…….5\n”);
    printf(“PARA SAIR DIGITE……………….0\n\n”);
    printf(“DIGITE AQUI: “);
    scanf(“%d”, &perg);
    if (perg == 5)
    cliente();
    if (perg == 0)
    sair();
    else
    printf(“ATENCAO DIGITE CORRETAMENTE\n”);
    v1();
    }
    void acumulaDep(int valorDep) { // Acumulador de depositos
    totalDep += valorDep;
    }
    int emprestimo() { // Função que libera saques como emprestimos com taxa de 2%
    time_t Segundos;
    time(&Segundos); //obtém a hora em segundos.
    DataAtual = localtime(&Segundos); //converte horas em segundos.
    system(“cls”);
    printf(“*****************************************************”);
    printf(“\n*************** CAIXA ELETRONICO S/A ****************”);
    printf(“\n*****************************************************”);
    printf(“\n*\t\t\t\t\t\t *\n*\t VOCE ESTA NA TELA EMPRESTIMO\t\t *\n”);
    printf(“*\t\t *ATENCAO*\t\t\t *\n”);
    printf(“* DIGITE SONENTE VALORES INTEIROS *\n”);
    printf(“*\t VALOR MAXIMO POR SAQUE R$ 1.000,00\t *\n”);
    printf(“* TAXA A SER COBRADA SOBRE O EMPRESTIMO: 8%% *\n”);
    printf(“**** SIGA AS INSTRUCOES PARA UTILIZACAO DO CAIXA ****\n\n”);
    printf (“DIGITE O VALOR DO EMPRESTIMO: R$ “);
    scanf (“%d”, &valorSaq);
    saldo = totalDep-(totalSaq+totalEmp+(totalEmp*juros)); // coloquei essa matemática para que o cálculo seja feito na hora,
    if (DataAtual->tm_hour >= 6 && DataAtual->tm_hour =0 && valorSaqtm_hour >= 22 || DataAtual->tm_hour >= 00 && DataAtual->tm_hour =0 && valorSaqtm_hour >= 6 && DataAtual->tm_hour 1000) {
    printf(“\n\t\t\t*ATENCAO*\nVALOR ACIMA DE R$ 1.000,00 – EXCEDEU SEU LIMITE DE SAQUE,\n”);
    printf(“COMPARECA A SUA AGENCIA PARA SACAR JUNTO AO SEU GERENTE!\n\n”);
    system(“pause”);
    emprestimo();
    }
    }
    if (DataAtual->tm_hour >= 22 || DataAtual->tm_hour >= 00 && DataAtual->tm_hour 600) {
    printf(“\n\t\t *ATENCAO*\nLIMITE DE SAQUE DE R$ 600,00 DAS 22:00HS AS 05:59HS\n”);
    printf(“HORARIO ATUAL: %02d:%02d:%02d\n\n”, DataAtual->tm_hour, DataAtual->tm_min, DataAtual->tm_sec);
    system(“pause”);
    emprestimo();
    }
    }
    }
    void acumulaEmp(int valorEmp) { // Acumulador de emprestimos
    totalEmp += valorEmp;
    }
    void saldoExtrato() { // Função que apresenta o histórico de saldo ao cliente
    saldo = totalDep-(totalSaq+totalEmp+(totalEmp*juros));
    system(“cls”);
    printf(“*****************************************************”);
    printf(“\n*************** CAIXA ELETRONICO S/A ****************”);
    printf(“\n*****************************************************”);
    printf(“\n*\t\t\t\t\t\t *\n*\t VOCE ESTA NA TELA SALDO\t\t *\n”);
    printf(“**** SIGA AS INSTRUCOES PARA UTILIZACAO DO CAIXA ****\n”);
    printf (“******* HISTORITO DE SUA CONTA CORRENTE *************\n\n”);
    printf (“VALOR TOTAL DE DEPOSITOS:………………+ %.2f\n\n”, totalDep); // Total de depositos
    printf (“VALOR TOTAL DE SAQUES:…………………- %.2f\n\n”, totalSaq); // Total de saques
    printf (“VALOR TOTAL DE EMPRESTIMOS:…………….- %.2f\n\n”, totalEmp); // Total de emprestimos
    printf (“VALOR TOTAL DE JUROS:………………….- %.2f\n\n”, juros*totalEmp); // Total de Juros sobre emprestimos
    printf (“SALDO ATUAL DE SUA CONTA CORRENTE:………= %.2f\n\n”, saldo); // Saldo atual de sua conta
    system(“pause”);
    }
    void acumulaN100Dep(short n100) { // Acumuladores de notas que entram ‘depositos’
    notas100Dep += n100;
    }
    void acumulaN50Dep(short n50) {
    notas50Dep += n50;
    }
    void acumulaN20Dep(short n20) {
    notas20Dep += n20;
    }
    void acumulaN10Dep(short n10) {
    notas10Dep += n10;
    }
    void acumulaN5Dep(short n5) {
    notas5Dep += n5;
    }
    void acumulaN2Dep(short n2) {
    notas2Dep += n2;
    }
    void acumulaN1Dep(short n1) {
    notas1Dep += n1;
    }
    void acumulaN100Saq(short s100) { // Acumulador de notas que saem ‘emprestimos e saques’
    notas100Saq += s100;
    }
    void acumulaN50Saq(short s50) {
    notas50Saq += s50;
    }
    void acumulaN20Saq(short s20) {
    notas20Saq += s20;
    }
    void acumulaN10Saq(short s10) {
    notas10Saq += s10;
    }
    void acumulaN5Saq(short s5) {
    notas5Saq += s5;
    }
    void acumulaN2Saq(short s2) {
    notas2Saq += s2;
    }
    void acumulaN1Saq(short s1) {
    notas1Saq += s1;
    }
    void notasDisponiveis() { // Função que apresenta ao cliente as notas disponiveis no caixa
    short notas100=100, notas50=100, notas20=100, notas10=100, notas5=100, notas2=100, notas1=100;
    notas100 += notas100Dep – notas100Saq;
    notas50 += notas50Dep – notas50Saq;
    notas20 += notas20Dep – notas20Saq;
    notas10 += notas10Dep – notas10Saq;
    notas5 += notas5Dep – notas5Saq; // O caixa inicia com 100 notas p/ cada valor e é feita subtração ou soma de acordo
    notas2 += notas2Dep – notas2Saq; // com a movimentação do caixa de notas que entram ‘depositos’ e que saem ‘saques’
    notas1 += notas1Dep – notas1Saq;
    system(“cls”);
    printf(“*****************************************************”);
    printf(“\n*************** CAIXA ELETRONICO S/A ****************”);
    printf(“\n*****************************************************”);
    printf(“\n*\t\t\t\t\t\t *\n* VOCE ESTA NA TELA NOTAS DISPONIVEIS\t *\n”);
    printf(“**** SIGA AS INSTRUCOES PARA UTILIZACAO DO CAIXA ****\n”);
    printf (“************** NOTAS DISPONIVEIS NO CAIXA ***********\n\n”);
    printf (“NOTAS DE R$ 100:……………………….%d NOTAS\n\n”, notas100);
    printf (“NOTAS DE R$ 50:……………………….%d NOTAS\n\n”, notas50);
    printf (“NOTAS DE R$ 20:……………………….%d NOTAS\n\n”, notas20);
    printf (“NOTAS DE R$ 10:……………………….%d NOTAS\n\n”, notas10);
    printf (“NOTAS DE R$ 5:……………………….%d NOTAS\n\n”, notas5);
    printf (“NOTAS DE R$ 2:……………………….%d NOTAS\n\n”, notas2);
    printf (“NOTAS DE R$ 1:……………………….%d NOTAS\n\n”, notas1);
    system(“pause”);
    }
    main() { // Função main que inicia o programa caixa
    system (“cls”);
    system(“color F9″);
    printf(“*****************************************************”);
    printf(“\n*************** CAIXA ELETRONICO S/A ****************”);
    printf(“\n*****************************************************”);
    printf(“\n*\t\t\t\t\t\t *\n*\t VOCE ESTA NA TELA INICIAL\t\t *\n”);
    printf(“**** SIGA AS INSTRUCOES PARA UTILIZACAO DO CAIXA ****\n\n”);
    printf(“0 – PARA SAIR DO CAIXA\n\n”);
    printf(“1 – PARA ACESSAR A CONTA\n\n”);
    printf(“DIGITE AQUI: “);
    scanf(“%d”, &perg);
    system(“cls”);
    switch(perg) {
    case 1:
    contaCorrente();
    break;

    case 0:
    sair();
    break;

    default:
    main();
    }
    }

    • Reinaldo Disse:

      Fernando bom dia !!! estava olhando que vc também esta fazendo um projeto em C de caixa eletronico, eu tb estou precisando para entregar na faculdade… Gostaria de saber se vc pode me enviar o projeto, ou me enviar as bibliotecas usadas no seu projeto pois no começo não esta aparecendo esta apenas o # include…

      Obrigado !!!!

  6. Emy Nakai Disse:

    Oi Fernando,
    Compilei seu código e existem dois erros na line 5 vc usou 5 bilbliotecas. Quais são elas?

  7. Paulo Disse:

    Preciso fazer um prototico de caixa eletronico em linguagem c++
    alguem pode me ajudar a desenvolver os codigos estou com muita dificuldade
    sem mais
    Paulo henrique.

  8. Fernando Disse:

    Tbm estou atras de um programa de um caixa eletronico
    alguem pode me ajudar?

  9. Alison Disse:

    Olá Fernando,
    Não teria como vc me mandar este projeto?
    Tenho um trabalho pra entregar na faculdade e o meu sistema ainda não está rodando como deveria.

    Obrigado.

    Alison

  10. Fernando Disse:

    Ai galera sou o Fernando, o cara que fez esse caixa eletrônico ai de cima utilizaei essas bibliotecas:

    #include stdio.h
    #include stdlib.h
    #include conio.h
    #include string.h
    #include time.h

    ai pessoal deu muito trabalho por isso peço que após ajuda-los gostaria que postassem comentário sobre o meu trabalho, valeu espero ter ajudado…

  11. Fernando Disse:

    Ai galera sou o Fernando, o cara que fez esse caixa eletrônico ai de cima utilizaei essas bibliotecas:

    #include stdio.h
    #include stdlib.h
    #include conio.h
    #include string.h
    #include time.h

    ai pessoal deu muito trabalho por isso peço que após ajuda-los gostaria que postassem comentário sobre o meu trabalho, valeu espero ter ajudado, podem postar no meu blog…

  12. Tiago Disse:

    Poxa fernando meus parabéns eu ainda não compilei mas só pelo fato do tamanho do código fonte da para ver que é um belo programa
    mas infelizmente quando vou copilar dar erro :(

    me ajuda

Deixe uma resposta

Preencha os seus dados abaixo ou clique em um ícone para log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Sair / Alterar )

Imagem do Twitter

You are commenting using your Twitter account. Sair / Alterar )

Foto do Facebook

You are commenting using your Facebook account. Sair / Alterar )

Connecting to %s


Seguir

Obtenha todo post novo entregue na sua caixa de entrada.