Controle de farmácia em C

Publicado por Rodrigo Zanuzzo (última atualizaçăo em 15/12/2009)

[ Hits: 19.410 ]

Homepage: @rodrigozanuzzo

Download farmacia.cpp




Desenvolvi este projeto juntamente com meus colegas de faculdade. É um controle de farmácia, utilizo um método de ordenação ShellSort, não trabalho com arquivo neste projeto.

Dêem uma olhada e digam o que acham, estou aprendendo ainda.

  



Esconder código-fonte

/*
Trabalho G1 Algoritmo e estrutura de dados II
Alunos:Rodrigo Zanuzzo, Vinicius Geremia, Patrick Carvalho
*/

#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <string.h>
#define x 100 //Constante
void menu();                      //funcao que chama o menu principal
void sair();                      //funcao para saida do programa
void controleVenda();             //funcao do menu de vendas
void controleProduto();           //menu do control de produtos
void menu2();                     //Funcao do menu de entrada
void sobre();                     //funcao de apresentae-ao dos academicos
void controlePessoa();            //Menu controle de pessoas
void bemvindo();                  //funcao de abertura do programa
int ProdutoExiste(int cod);       //Funçao verifica se o produto esta no banco de dados
int PessoaExiste(int cod);        //Funçao verifica se o funcionario esta no banco de dados
int compare (const void * a, const void * b);
//definindo estruturas para armaznamento de, pessoas, produtos, e registro de vendas
typedef struct pessoas{
    int codigo;
    char nome[20];
    char sobrenome[20];
    float salario;
};
typedef struct produtos{
    int codigo;
    float pcompra;
    float pvenda;
    char descricao[200];
    int quantidade;
    char validade[50];
};
typedef struct vendas{
    int lista;
    double total;
};
     pessoas pes[x];
     produtos pro[x];
     int QtdProdCad = 2;
     int quantidade=x;
     int qnt=0;
     int cod=0;
     int codProduto=0;
     int codCliente=0;
     int codPessoa=0;
     float valor,total=0,saldo=0;
    
//BLOCO PRINCIPAL, entrada das pessoas e produtos padroes
int main(){
//funcionarios padrao
    pes[0].codigo=15;
    strcpy (pes[0].nome,"Joao");
    strcpy (pes[0].sobrenome,"Silva");
    pes[0].salario=100;
    pes[1].codigo=20;
    strcpy (pes[1].nome,"Pedro");
    strcpy (pes[1].sobrenome,"Souza");
    pes[1].salario=900;
    pes[2].codigo=10;
    strcpy (pes[2].nome,"Ana");
    strcpy (pes[2].sobrenome,"Oliveira");
    pes[2].salario=600;
    pes[3].codigo=5;
    strcpy (pes[3].nome,"Jose");
    strcpy (pes[3].sobrenome,"Pereira");
    pes[3].salario=700;
//remedios padrao   
    pro[97].codigo=15;
    strcpy (pro[97].descricao,"Aspirina");
    pro[97].quantidade=20;
    pro[97].pvenda=1;
    pro[97].pcompra=0.5;
    strcpy (pro[97].validade,"10/01/2010");
    pro[98].codigo=10;
    strcpy (pro[98].descricao,"Analgesico");
    pro[98].quantidade=30;
    pro[98].pvenda=2;
    pro[98].pcompra=0.9;
    strcpy (pro[98].validade,"15/01/2010");
    pro[99].codigo=5;
    strcpy (pro[99].descricao,"Dipirona");
    pro[99].quantidade=50;
    pro[99].pvenda=3;
    pro[99].pcompra=1;
    strcpy (pro[99].validade,"03/01/2010");  
    bemvindo();
}
//funcao do entrada do menu principal
void menu(){
     int op;
     system("cls");
     printf("Menu Principal:");
     printf("\n{1} -> Efetuar Vendas");
     printf("\n{2} -> Controle de Funcionarios");
     printf("\n{3} -> Controle de Produtos");
     printf("\n{4} -> Voltar\n");
     scanf("%d",&op);
     switch(op){
         case 1: {                                        //opcao 1, faz entrada no meuno do contrle de vendas
              system("cls");
              controleVenda();
              getch();
              menu();
              break;
         }
         case 2: {                                        //opcao 2, faz entrada do menu de controle de pessoas
              controlePessoa();
              getch();
              menu();
              break;
         }
         case 3: {                                        //opcao 3 faz entrada do menu de controle de pessoa
               controleProduto();
               getch();
               menu();
               break;
          }
           case 4: {                                      //opcao 4, voltar para o menu de entrada
               menu2();
               getch();
               menu();
               break;
            }
            default: {                                     //caso o usuario digite uma opcao nao valida ee retonr ao menu, e avisa o usuario
               printf("Opcao Invalida");
               getch();
               menu();
            }
       }
}              
//funcao do controle de vendas
void controleVenda(){
     system("cls");
     int op,quant;
     char cond;
     printf("Controle de venda:");
     printf("\n{1} -> Cadastrar nova venda");
     printf("\n{2} -> Saldo do dia");
     printf("\n{3} -> Voltar\n");
     scanf("%d",&op);
     switch(op){
         case 1: {                                         //funcao para efetuar venda,  faz os caucolos e mais informaçoes para ajudar o usuario
              int i=0;
              do{
                system("cls");  
                printf("Informe o codigo do produto:");
                scanf("%d",&cod);
                 if (ProdutoExiste(cod) != 1){ //verifica se o produto esta cadastrado
                     printf("Produto inexistente !");
                     getch();
                     controleVenda();
            }else{                 
                printf("Produto:\t\t%s\nValor Unitario\t\t%.2f\nQuantidade em estoque\t%d\n",pro[codProduto].descricao,pro[codProduto].pvenda,pro[codProduto].quantidade);                
                printf("Informe a quantidade de %s a ser vendido:\n",pro[codProduto].descricao);
                scanf("%d",&quant);
                if(quant<pro[codProduto].quantidade){                                                     
                    valor=quant*pro[codProduto].pvenda;
                    total=total+valor;
                    saldo=saldo+total;
                    pro[cod].quantidade=pro[codProduto].quantidade-quant;
                    }else{
                     printf("Quantidade insuficiente em estoque\n");
                     getch();
                     controleVenda();                                                    
                 }                                                              
            }
            printf("\nSub total:%.2f\n",total);
            printf("Deseja finalizar a venda(s/n)?:\n");
            scanf("%s",&cond);
            }
            while(cond!='s');
            printf("Total a pagar: R$%.2f",total);
            total=0;
            getch();
            controleVenda();   
            break;
            }
            case 2:{                                                                        //opcao 2, imprime o saldo do dia
                 printf("O saldo do dia e: R$%.2f",saldo);
                 getch();
                 controleVenda();   
                 break;   
            }
            case 3:{                                                                        //opcao 3, volta para o menu
                 menu();   
                 break;   
            }   
            default: {                                                                      // informa o cliente quando ele digita um valor que nao coresponde ao menu
                  printf("Opcao Invalida");
                  getch();
                  controleVenda();
            }
            }
}
 //funcao de saida do programa
void sair(){
   system("cls");
   printf("Obrigado por utilizr nosso sistema");
   getch();
   exit (0);
}
//Menu de entrada
void menu2(){
     int op;
     system("cls");
     printf("Menu Principal:");
     printf("\n{1} -> Entrar");
     printf("\n{2} -> Sobre");
     printf("\n{3} -> Sair\n");
     scanf("%d",&op);
switch(op){
                case 1: {
                         menu();                                                            //opcao 1, abre o menu principal
                         getch();
                         menu2();
                         break;
                }
                case 2: {                                                                    //opcao 2, abre as informacoes sobre os academicos
                         sobre();
                         getch();
                         menu2();
                         break;
                }
                case 3: {                                                                    //opcao de saida do programa
                         sair();
                         getch();
                         break;
                }
                default: {                                                                   //informa quando o usuario digita uma opcao invalida
                          printf("Opcao Invalida");
                          getch();
                          menu2();
                         }
                }
}
//funcao de apresentasao do progeto
void sobre(){
      system("cls");
      printf("\n\n Sobre o Programa");
      printf("\n Desenvolvido pelos academicos :\n Rodrigo Zanuzzo, Patrick Carvalho, Vinicius Geremia ");
     }
//funcao de entrada do programa
void bemvindo(){
     printf("******************************************************************************\n\n\n");
     printf("                         Bem Vindo ao programa UnoFarma\n\n\n");
     printf("******************************************************************************\n");
     getch();
     menu2();
}
//funcao do menu de controle de pessoas
void controlePessoa(){
     int op;
     system("cls");
                     printf("Controle de funcionarios:");
                     printf("\n{1} -> Cadastro de funcionarios");
                     printf("\n{2} -> Consulta de funcionarios");
                     printf("\n{3} -> Alterar cadastro de funcionarios");
                     printf("\n{4} -> Excluir cadastro de funcionarios");
                     printf("\n{5} -> Voltar\n");
                     scanf("%d",&op);
                     switch(op){
                                case 1:{                              //opcao 1, para o usuario poder fazer cadastro de pessoas
                                char cond;
                                do{                                                                      
                                        printf("\n Informe o codigo do funcionario\n");
                                        scanf("%d",&cod);
                                        if (PessoaExiste(cod) == 1){ //verifica se o pessoa esta cadastrado
                                  printf("Funcionario ja cadastrado !");
                                  getch();
                                           controlePessoa();                                                                                            
                                           }else{
                                        while(pes[codPessoa].codigo>0){
                                              codPessoa=codPessoa+1;                          
                                        }                                                                                                             
                                        pes[codPessoa].codigo=cod;
                                        printf("\n Informe o nome\n");
                                        fflush(stdin);
                                        gets(pes[codPessoa].nome);
                                        printf("\n Informe o sobrenome\n");
                                        fflush(stdin);
                                        gets(pes[codPessoa].sobrenome);
                                        printf("\n Informe o Salario\n");
                                        scanf("%f",&pes[codPessoa].salario);
                                        }
                                        printf("\n Deseja cadastrar outro funcionario:(s/n)");
                                        scanf("%s",&cond);
                                }
                                while(cond!='n');
                                controlePessoa();
                                break;
                                }
                                case 2:{                                 //menu de consulta de funcionarios
                                     system("cls");
                                     int opcao;
                                     printf("{1} -> Consultar por codigo\n");
                                     printf("{2} -> Exibir todos os funcionarios\n");
                                     printf("{3} -> Ordenar por codigo\n");
                                     printf("{4} -> voltar\n");
                                     scanf("%d",&opcao);
                                     switch (opcao){
                                            case 1:{                                                                                                 
                                     int cod;
                                     printf("Informe o codigo da pessoa\n");
                                     scanf("%d",&cod);
                                     for(int i=0;i<x;i++){
                                                         if(pes[i].codigo==cod){
                                                                   printf ("\nCodigo: %d\nNome: %s\n",pes[i].codigo, pes[i].nome);
                                                                   printf ("Sobrenome: %s\nSalario: %.2f\n\n", pes[i].sobrenome, pes[i].salario);          
                                                         }                                                
                                                 }
                                     getch();
                                     controlePessoa();                                  
                                      break;
                                      }
                                            case 2:{                                     //exibe todos os funcionarios na ordem da posisao dele
                                                 system("cls");
                                                 for(int i=0;i<x;i++){
                                                         if(pes[i].codigo>0){
                                                                   printf ("\nCodigo: %d\nNome: %s\n",pes[i].codigo, pes[i].nome);
                                                                   printf ("Sobrenome: %s\nSalario: %.2f\n\n", pes[i].sobrenome, pes[i].salario);          
                                                         }                                                
                                                 }
                                                 }
                                                 getch();
                                                 controlePessoa();
                                                  break;
                                            case 3:{                                       //opcao 3, imprime os funcionarios na ordem crecente do codigo
                                                 int i , j , valor,c;
                                                 char valor1[20],valor2[50];
                                                 float valor3;
                                                 int gap = 1;
                                                 do {
                                                      gap = 3*gap+1;
                                                 } while(gap < x);
                                                 do {
                                                    gap /= 3;
                                                    for(i = gap; i < x; i++) {
                                                        valor =pes[i].codigo;
                                                        strcpy(valor1, pes[i].nome);
                                                        strcpy(valor2, pes[i].sobrenome);
                                                        valor3 =pes[i].salario;
                                                        j = i - gap;
                                                    while (j >= 0 && valor < pes[j].codigo) {
                                                        pes[j + gap].codigo = pes[j].codigo;
                                                        strcpy(pes[j + gap].nome,pes[j].nome);
                                                        strcpy(pes[j + gap].sobrenome,pes[j].sobrenome);
                                                        pes[j + gap].salario = pes[j].salario;
                                                        j -= gap;
                                                    }
                                                    pes[j + gap].codigo = valor;
                                                    strcpy(pes[j + gap].nome, valor1);
                                                    strcpy(pes[j + gap].sobrenome, valor2);
                                                    pes[j + gap].salario = valor3;
                                                    }
                                                    } while ( gap > 1);
                                                    system ("cls");
                                                    printf ("Codigo\t|Nome\t\t|Sobrenome\t\t|Salario\n");
                                                    for (c=0;c<x;c++){
                                                        if (pes[c].salario > 0)
                                                          printf ("%d\t|%s\t\t|%s\t\t| R$ - %.2f\n", pes[c].codigo,pes[c].nome,pes[c].sobrenome,pes[c].salario);   
                                                        }
                                                    printf ("\n\n\n");                                                
                                                    getch();
                                                    controlePessoa();                                   
                                                    break;
                                                }
                                            case 4:{                                                                 //opcao 4, volta para o menu do controle de produtos
                                                 getch();
                                                 controlePessoa();                                   
                                                 break;
                                                 }         
                                    
                                }
                                }
                                case 3:{                                                                             //opcao 3, funcao para alterar os dados dos funcionarios
                                     char cond;
                                     do{
 
                                           printf("Informe o codigo do funcionario a ser alterado\n");
                                           scanf("%d",&cod);
                                           if (PessoaExiste(cod) != 1){
                                  printf("Funcionario inexistente !\n");
                                  getch();
                                           controlePessoa();                                 
                                     }
                                     else{                                          
                                           printf("Nome: %s\n",pes[codPessoa].nome);
                                           printf("Sobrenome: %s\n",pes[codPessoa].sobrenome);
                                           printf("Salario: %.2f\n",pes[codPessoa].salario);
                                           printf("\n Informe o novo codigo do funcionario\n");
                                           scanf("%d",&pes[codPessoa].codigo);
                                           printf("\n Informe o novo nome\n");
                                           fflush(stdin);
                                           gets(pes[codPessoa].nome);
                                           printf("\n Informe o novo sobrenome\n");
                                           fflush(stdin);
                                           gets(pes[codPessoa].sobrenome);
                                           printf("\n Informe o novo Salario\n");
                                           scanf("%f",&pes[codPessoa].salario);     
                                           printf("\n Deseja alterar outro funcionario(s/n)?");
                                           scanf("%s",&cond);
                                           }
                                     }
                                     while(cond!='n');
                                     controlePessoa();
                                     break;
                                }
                                case 4:{                                                                             //opcao 4, o usuario informa o codigo do funcionario, e confirma a exclusao do mesmo
                                    char cond,resp;                                                                    
                                    do{                                           
                                           printf("Informe o codigo do funcionario a ser excluido\n");
                                           scanf("%d",&cod);
                                           if (PessoaExiste(cod) != 1){ //verifica se o pessoa esta cadastrado
                                  printf("Funcio inexistente !");
                                  getch();
                                           controlePessoa();
                                           }else{
                                           printf("Nome: %s\n",pes[codPessoa].nome);
                                           printf("Sobrenome: %s\n",pes[codPessoa].sobrenome);
                                           printf("Salario: %f\n",pes[codPessoa].salario);
                                           printf("\n Deseja realmente excluir este cadastro(s/n)\n");
                                           scanf("%s",&resp);  
                                           }
                                           if(resp='s'){  
                                              pes[codPessoa].codigo=0;            
                                              strcpy (pes[codPessoa].nome,"");
                                              strcpy (pes[codPessoa].sobrenome,"");
                                              pes[codPessoa].salario=0;;
                                           }                                     
                                           printf("\n Deseja excluir outro funcionario (s/n)\n");
                                           scanf("%s",&cond);
                                    }
                                    while(cond!='n');
                                    controlePessoa();
                                    break;
                                }
                                case 5: {                                                                                //opcao 5, volta para o menu principal
                                   menu();
                                   break;
                                }
                                default: {
                                   printf("Opcao Invalida");
                                   getch();
                                   controlePessoa();
                                }  
                       }
}
//Controle de produto
void controleProduto(){
                     int op;
                     system("cls");
                     printf("Controle de produtos:");
                     printf("\n{1} -> Cadastro de produtos");
                     printf("\n{2} -> Consulta de produto");
                     printf("\n{3} -> Listar Produtos");
                     printf("\n{4} -> Alterar cadastro de produto");
                     printf("\n{5} -> Excluir cadastro de produto");
                     printf("\n{6} -> Voltar\n");
                     scanf("%d",&op);
                     switch(op){
                                case 1:{//Cadastro de produto
                                char cond;
                                do{                                                                      
                                        printf("\n Informe o codigo do produto\n");
                                        scanf("%d",&cod);
                                        if (ProdutoExiste(cod) == 1){ //verifica se o produto esta cadastrado                                                                                                                                                     
                                                  printf("Produto ja castrado !");
                                                  getch();
                                                  controleProduto();
                                           }else{
                                                  while(pro[codProduto].codigo>0){
                                                         codProduto=codProduto+1;                          
                                                  }
                                                  pro[codProduto].codigo=cod;                                            
                                                  printf("\n Informe o nome do produto \n");
                                                  fflush(stdin);
                                                  gets(pro[codProduto].descricao);
                                                  printf("\n Informe a quantidade em estoque \n");
                                                  scanf("%d",&pro[codProduto].quantidade);
                                                  printf("\n Informe o Valor de Compra \n");
                                                  scanf("%f",&pro[codProduto].pcompra);
                                                  printf("\n Informe o Valor de Venda \n");
                                                  scanf("%f",&pro[codProduto].pvenda);
                                                  printf("\n Informe a validade do produto \n");
                                                  fflush(stdin);
                                                  gets(pro[codProduto].validade);
                                                 
                                        }
                                        printf("\n Deseja cadastrar outro produto:(s/n)?");
                                        scanf("%s",&cond);
                                }
                                while(cond!='n');
                                controleProduto();
                                break;
                                }
                                case 2:{//Consultar o cadastro de produto                               
                                     system("cls");
                                     int opcao;
                                     printf("{1} -> Consultar por codigo\n");;
                                     printf("{2} -> Ordenar produtos\n");
                                     printf("{3} -> voltar\n");
                                     scanf("%d",&opcao);
                                     switch (opcao){
                                            case 1:{                //procura o codigo por codigo                                                                                 
                                     printf("Informe o codigo do produto \n");
                                     scanf("%d",&cod);
                                     for(int i=0;i<x;i++){
                                            
                                             if(pro[i].codigo==cod){
                                               printf ("\nCodigo: %d\nNome: %s\n",pro[i].codigo, pro[i].descricao);
                                               printf ("Quantidade: %d\nValor de compra: %.2f\nValor de venda: %.2f\nValidade: %s\n\n", pro[i].quantidade, pro[i].pcompra, pro[i].pvenda,pro[cod].validade);
                                               }                                                
                                     }
                                     getch();
                                     controleProduto();                                   
                                     break;
                                           
                                            case 2:{ //Metodo que ordena os produtos
                                                 int i , j , valor,c;
                                                 char valor1[20],valor4[50];
                                                 float valor2,valor3;
                                                 int gap = 1;
                                                 do {
                                                      gap = 3*gap+1;
                                                 } while(gap < x);
                                                 do {
                                                    gap /= 3;
                                                    for(i = gap; i < x; i++) {
                                                        valor =pro[i].codigo;
                                                        strcpy(valor1, pro[i].descricao);
                                                        strcpy(valor4, pro[i].validade);
                                                        valor2 =pro[i].pcompra;
                                                        valor3 =pro[i].pvenda;
                                                        j = i - gap;
                                                    while (j >= 0 && valor < pro[j].codigo) {
                                                        pro[j + gap].codigo = pro[j].codigo;
                                                        strcpy(pro[j + gap].descricao,pro[j].descricao);
                                                        strcpy(pro[j + gap].validade,pro[j].validade);
                                                        pro[j + gap].pcompra = pro[j].pcompra;
                                                        pro[j + gap].pvenda = pro[j].pvenda;
                                                        j -= gap;
                                                    }
                                                    pro[j + gap].codigo = valor;
                                                    strcpy(pro[j + gap].descricao, valor1);
                                                    strcpy(pro[j + gap].validade, valor4);
                                                    pro[j + gap].pcompra = valor2;
                                                    pro[j + gap].pvenda = valor3;
                                                    }
                                                    } while ( gap > 1);
                                                    system ("cls");
                                                    printf ("Codigo\t|Nome\t\t|Preco de compra\t|Preco de venda\t|Validade\n");
                                                    for (c=0;c<x;c++){
                                                        if (pro[c].pcompra > 0)//Exibe os remedios ordenados somente os cadastrados
                                                          printf ("%d\t|%s\t| R$ - %.2f\t\t| R$ - %.2f\t|%s\n", pro[c].codigo,pro[c].descricao,pro[c].pcompra,pro[c].pvenda,pro[c].validade);
                                                        }   
                                                    printf ("\n\n\n");                                                
                                                    getch();
                                                    controleProduto();                                   
                                                    break;
                                                }
                                            case 3:{ //voltar
                                                 getch();
                                                 controleProduto();                                   
                                                 break;
                                                 }         
                                    
                                }
                                }
                                case 3:{//Exibir todos os Produtos
                                     system("cls");
                                                 for(int i=0;i<x;i++){
                                                         if(pro[i].codigo>0){
                                                                   printf ("\nCodigo: %d\nNome: %s\n",pro[i].codigo, pro[i].descricao);
                                                                   printf ("Quantidade: %d\nValor de compra: %.2f\nValor de venda: %.2f\nValidade: %s\n\n", pro[i].quantidade, pro[i].pcompra, pro[i].pvenda,pro[i].validade);
                                                         }                                                
                                                 }
                                                 }
                                                 getch();
                                                 controleProduto();
                                                  break;
                                }
                                                     
                                case 4:{//Altera um cadastro de produtos
                                     char cond;
                                     do{
 
                                           printf("Informe o codigo do produto a ser alterado\n");
                                           scanf("%d",&cod);
                                           if (ProdutoExiste(cod) != 1){ //verifica se o codigo esta castrado
                                  printf("Produto inexistente !");
                                  getch();
                                           controleProduto();
                                 
                                  }
                                  else{
                                           printf("Nome: %s\n",pro[codProduto].descricao);
                                           printf("Quantidade: %d\n",pro[codProduto].quantidade);
                                           printf("Valor de Compra: %.2f\n",pro[codProduto].pcompra);
                                           printf("Valor de Venda: %.2f\n",pro[codProduto].pvenda);
                                           printf("Validade: %s\n\n",pro[codProduto].validade);
                                           printf("\n Informe o novo codigo do produto\n");
                                           scanf("%d",&pro[codProduto].codigo);
                                           printf("\n Informe o novo nome do produto\n");
                                           fflush(stdin);
                                           gets(pro[codProduto].descricao);
                                           printf("\n Informe o nova quantidade\n");
                                           scanf("%d",&pro[codProduto].quantidade);
                                           printf("\n Informe o novo Valor de Compra\n");
                                           scanf("%f",&pro[codProduto].pcompra);     
                                           printf("\n Informe o novo Valor de Venda\n");
                                           scanf("%f",&pro[codProduto].pvenda);
                                           printf("\n Informe o nova validade\n");
                                           fflush(stdin);
                                           gets(pro[codProduto].validade);
                                           }
                                           printf("\n Deseja alterar outro produto(s/n)?");
                                           scanf("%s",&cond);
                                     }
                                     while(cond!='n');
                                     controleProduto();
                                     break;
                                }
                                case 5:{//Excuir o cadastro de produto
                                    char cond,resp;                                                                     
                                    do{                                           
                                           printf("Informe o codigo do produto a ser excluido\n");
                                           scanf("%d",&cod);
                                           if (ProdutoExiste(cod) != 1){ //verifica se o produto esta cadastrado
                                                  printf("Produto inexistente !");
                                                  getch();
                                                           controleProduto();
                                  }else{
                                           printf ("\nCodigo: %d\nNome: %s\n",pro[codProduto].codigo, pro[codProduto].descricao);
                                           printf ("Quantidade: %d\nValor de compra: %.2f\nValor de venda %.2f\n Validade: %s\n\n", pro[codProduto].quantidade, pro[codProduto].pcompra, pro[codProduto].pvenda,pro[codProduto].validade);
                                           printf("\n Deseja realmente excluir este produto(s/n)?\n");
                                           scanf("%s",&resp);
                                           }  
                                           if(resp='s'){  
                                           pro[codProduto].codigo=0;
                                           strcpy (pro[codProduto].descricao,"");
                                           pro[codProduto].quantidade=0;
                                           pro[codProduto].pvenda=0;
                                           pro[codProduto].pcompra=0;
                                           strcpy (pro[codProduto].validade,"");
                                           }                                     
                                       printf("\n Deseja excluir outro produto(s/n)?");
                                       scanf("%s",&cond);
                                    }
                                    while(cond!='n');
                                    controleProduto();
                                    break;
                                }
                                case 6: { //Voltar
                                   menu();
                                   getch();
                                   controleProduto();
                                   break;
                                }
                                default: {
                                   printf("Opcao Invalida");
                                   getch();
                                   controleProduto();
                                }  
                       }
}
int ProdutoExiste(int cod){//Verifica se o produto esta cadastrado
 int i;
 int Retorno = 0;
 for (i = 0; i < x; i++){
  if (pro[i].codigo == cod){
  codProduto=i;
   Retorno = 1;
} 
 }
 return Retorno;
}
int PessoaExiste(int cod){ //verifica se o funcionario
 int i;
 int Retorno = 0;
 for (i = 0; i < x; i++){
  if (pes[i].codigo == cod){
  codPessoa=i;
   Retorno = 1;
}
 }
 return Retorno;
}

Scripts recomendados

Administraçăo de um Teatro

Uso do comando for e printf

Mostra valores da tabela ascii

Tabuada no terminal

Jogo da velha - Contra PC


  

Comentários
[1] Comentário enviado por andrezc em 16/12/2009 - 19:04h

system("cls"); ?


[2] Comentário enviado por rodrigozanuzzo em 17/12/2009 - 07:49h

Pois é estou parando com esse vicio.
Aos poucos estou me desapegando do Ruindows.

[3] Comentário enviado por Matheusin em 20/02/2022 - 05:52h


Li recentemente um artigo sobre parasitas no https://precocpa.pt/wortex/ e diz que os parasitas são muito perigosos para a saúde, isso é verdade? Para ser honesto, eu não sabia que eles poderiam ser tão perigosos. Eu também li sobre o Wortex como diz no artigo que ele funciona melhor e mata os parasitas no corpo.


Contribuir com comentário




Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts