Ir ao conteúdo
  • Cadastre-se

Caio.Barret0

Membro Júnior
  • Posts

    3
  • Cadastrado em

  • Última visita

Reputação

1
  1. Tentei muita coisa, mas até agora não consegui, precisava que meu ultimo void funcionasse, com a função de eu poder pesquisar especificamente todos do mesmo status, sendo eles "a fazer fazendo", "fazendo" e "concluído", se alguém conseguir me passar a solução agradeço muito. #include <stdio.h> #include <stdlib.h> #include <string.h> #include <locale.h> #define max 200 typedef struct dados{ int cod; char nome[30]; int status; }base_projetos; int pos = 0; void Cadastrar_Projeto(base_projetos cadastro[max]); void Buscar_Projeto(base_projetos cadastro[max]); void Listar_Projeto(base_projetos cadastro[max]); int main(){ setlocale(LC_ALL, "Portuguese"); base_projetos cadastro [max]; int opc; system("cls"); do{ system("cls"); printf("-------------------------------------------------------------\n"); printf(" PROJETOS"); printf("\n-------------------------------------------------------------\n"); printf("\n1)CADASTRAR PROJETO"); printf("\n2)BUSCAR PROJETO"); printf("\n3)LISTAR PROJETOS"); printf("\n4)SAIR\n"); printf("\n-----------------------------"); printf("\n ESCOLHA UMA OPÇÃO DO MENU"); printf("\n-----------------------------\n"); printf("R: "); scanf("%d", &opc); fflush(stdin); switch(opc){ case 1: Cadastrar_Projeto(cadastro); break; case 2: Buscar_Projeto(cadastro); break; case 3: Listar_Projeto(cadastro); break; case 4: system("cls"); printf("SAINDO DO APLICATIVO....\n"); printf("\n\n\nMUITO OBRIGADO POR UTILIZAR, VOLTE SEMPRE \n\n"); printf("-------------CAIO BARRETO----------------\n\n"); system("pause"); break; default: printf("\nESCOLHA ERRADA!!!\n"); system("pause"); } }while(opc != 4); return 0; } void Cadastrar_Projeto(base_projetos cadastro[max]){ system("cls"); printf("----------------------------------------"); printf("\nBEM VINDO AO CADASTRO DE PRODUTOS"); printf("\n----------------------------------------"); char resp = 's'; int resps = 0; while(resp == 's' && pos <= max){ pos++; printf("\nCÓDIGO: %d", pos); cadastro[pos].cod = pos; printf("\nINFORME O NOME DO PROJETO:\n"); fflush(stdin); gets(cadastro[pos].nome); printf("\nINFORME O STATUS DO PROJETO:\n"); printf("[1] - A FAZER FAZENDO [2] - FAZENDO [3] CONCLUÍDO:\n"); printf("R: "); scanf("%d", &resps); switch(resps){ case 1: cadastro[pos].status = 1; break; case 2: cadastro[pos].status = 2; break; case 3: cadastro[pos].status = 3; break; default: printf("\nESCOLHA ERRADA!!!\n"); system("Pause"); } if(pos < max){ printf("\n\nDESEJA CADASTRAR NOVO PROJETO? [s] SIM [n] NÃO\n"); printf("R: "); fflush(stdin); scanf("%c", &resp); system("cls"); }else{ printf("\nSUA BASE DE DADOS JÁ CHEGOU AO LIMITE!!!\n"); resp = 'n'; } } } void Buscar_Projeto(base_projetos cadastro[max]){ system("cls"); int cod, achou; printf("----------------------------------------"); printf("\n BUSCAR PROJETO"); printf("\n----------------------------------------"); printf("\n\nBUSCAR POR CÓDIGO:\n"); scanf("%d", &cod); fflush(stdin); achou = 0; int j = 0; while((achou == 0) && (j <= pos)){ if(cod == cadastro[j].cod){ printf("\nCÓDIGO: %d",cadastro[j].cod); printf("\nNOME: %s\n",cadastro[j].nome); printf("STATUS: "); if(cadastro[j].status == 1){ printf("A FAZER FAZENDO\n"); } if(cadastro[j].status == 2){ printf("FAZENDO\n"); } if(cadastro[j].status == 3){ printf("CONCLUÍDO\n"); } achou = 1; system("pause"); } j++; } if(achou == 0){ printf("\nREGISTRO NÃO ESCONTRADO COM O CÓDIGO %d \n", cod); system("pause"); } } void Listar_Projeto(base_projetos cadastro[max]){ system("cls"); int BuscaStatus,achou,i; printf("------------------------------------------"); printf("\n LISTAR PROJETOS"); printf("\n------------------------------------------\n\n"); printf("QUAL DESEJA LISTAR?"); printf("\n[1] A FAZER FAZENDO [2] FAZENDO [3] CONCLUÍDO\n"); scanf("%d", &BuscaStatus); fflush(stdin); i = 0; achou=0; system("pause"); }
  2. @kgin #include <stdio.h> #include <stdlib.h> #include <string.h> #include <locale.h> #define max 200 typedef struct dados{ int cod; char nome[30]; int status; }base_projetos; int pos = 0; void Cadastrar_Projeto(base_projetos cadastro[max]); void Buscar_Projeto(base_projetos cadastro[max]); void Listar_Projeto(base_projetos cadastro[max]); int main(){ setlocale(LC_ALL, "Portuguese"); base_projetos cadastro [max]; int opc; system("cls"); do{ system("cls"); printf("-------------------------------------------------------------\n"); printf(" PROJETOS"); printf("\n-------------------------------------------------------------\n"); printf("\n1)CADASTRAR PROJETO"); printf("\n2)BUSCAR PROJETO"); printf("\n3)LISTAR PROJETOS"); printf("\n4)SAIR\n"); printf("\n-----------------------------"); printf("\n ESCOLHA UMA OPÇÃO DO MENU"); printf("\n-----------------------------\n"); printf("R: "); scanf("%d", &opc); fflush(stdin); switch(opc){ case 1: Cadastrar_Projeto(cadastro); break; case 2: Buscar_Projeto(cadastro); break; case 3: Listar_Projeto(cadastro); break; case 4: system("cls"); printf("SAINDO DO APLICATIVO....\n"); printf("\n\n\nMUITO OBRIGADO POR UTILIZAR, VOLTE SEMPRE \n\n"); printf("-------------CAIO BARRETO----------------\n\n"); system("pause"); break; default: printf("\nESCOLHA ERRADA!!!\n"); system("pause"); } }while(opc != 4); return 0; } void Cadastrar_Projeto(base_projetos cadastro[max]){ system("cls"); printf("----------------------------------------"); printf("\nBEM VINDO AO CADASTRO DE PRODUTOS"); printf("\n----------------------------------------"); char resp = 's'; int resps = 0; while(resp == 's' && pos <= max){ pos++; printf("\nCÓDIGO: %d", pos); cadastro[pos].cod = pos; printf("\nINFORME O NOME DO PROJETO:\n"); fflush(stdin); gets(cadastro[pos].nome); printf("\nINFORME O STATUS DO PROJETO:\n"); printf("[1] - A FAZER FAZENDO [2] - FAZENDO [3] CONCLUÍDO:\n"); printf("R: "); scanf("%d", &resps); switch(resps){ case 1: cadastro[pos].status = 1; break; case 2: cadastro[pos].status = 2; break; case 3: cadastro[pos].status = 3; break; default: printf("\nESCOLHA ERRADA!!!\n"); system("Pause"); } if(pos < max){ printf("\n\nDESEJA CADASTRAR NOVO PROJETO? [s] SIM [n] NÃO\n"); printf("R: "); fflush(stdin); scanf("%c", &resp); system("cls"); }else{ printf("\nSUA BASE DE DADOS JÁ CHEGOU AO LIMITE!!!\n"); resp = 'n'; } } } void Buscar_Projeto(base_projetos cadastro[max]){ system("cls"); int cod, achou; printf("----------------------------------------"); printf("\n BUSCAR PROJETO"); printf("\n----------------------------------------"); printf("\n\nBUSCAR POR CÓDIGO:\n"); scanf("%d", &cod); fflush(stdin); achou = 0; int j = 0; while((achou == 0) && (j <= pos)){ if(cod == cadastro[j].cod){ printf("\nCÓDIGO: %d",cadastro[j].cod); printf("\nNOME: %s\n",cadastro[j].nome); printf("STATUS: "); if(cadastro[j].status == 1){ printf("A FAZER FAZENDO\n"); } if(cadastro[j].status == 2){ printf("FAZENDO\n"); } if(cadastro[j].status == 3){ printf("CONCLUÍDO\n"); } achou = 1; system("pause"); } j++; } if(achou == 0){ printf("\nREGISTRO NÃO ESCONTRADO COM O CÓDIGO %d \n", cod); system("pause"); } } void Listar_Projeto(base_projetos cadastro[max]){ system("cls"); int BuscaStatus,achou,i; printf("------------------------------------------"); printf("\n LISTAR PROJETOS"); printf("\n------------------------------------------\n\n"); printf("QUAL DESEJA LISTAR?"); printf("\n[1] A FAZER FAZENDO [2] FAZENDO [3] CONCLUÍDO\n"); scanf("%d", &BuscaStatus); fflush(stdin); i = 0; achou=0; system("pause"); system("Pause"); }
  3. No caso o ultimo void que estou com problemas, não consigo listar por seu status, sendo: "a fazer fazendo", "fazendo" ou "concluído" quem poder me ajudar agradeço muito. < #include <stdio.h> #include <stdlib.h> #include <string.h> #include <locale.h> #define max 200 typedef struct dados{ int cod; char nome[30]; int status; }base_projetos; int pos = 0; void Cadastrar_Projeto(base_projetos cadastro[max]); void Buscar_Projeto(base_projetos cadastro[max]); void Listar_Projeto(base_projetos cadastro[max]); int main(){ setlocale(LC_ALL, "Portuguese"); base_projetos cadastro [max]; int opc; system("cls"); do{ system("cls"); printf("-------------------------------------------------------------\n"); printf(" PROJETOS"); printf("\n-------------------------------------------------------------\n"); printf("\n1)CADASTRAR PROJETO"); printf("\n2)BUSCAR PROJETO"); printf("\n3)LISTAR PROJETOS"); printf("\n4)SAIR\n"); printf("\n-----------------------------"); printf("\n ESCOLHA UMA OPÇÃO DO MENU"); printf("\n-----------------------------\n"); printf("R: "); scanf("%d", &opc); fflush(stdin); switch(opc){ case 1: Cadastrar_Projeto(cadastro); break; case 2: Buscar_Projeto(cadastro); break; case 3: Listar_Projeto(cadastro); break; case 4: system("cls"); printf("SAINDO DO APLICATIVO....\n"); printf("\n\n\nMUITO OBRIGADO POR UTILIZAR, VOLTE SEMPRE \n\n"); printf("-------------CAIO BARRETO----------------\n\n"); system("pause"); break; default: printf("\nESCOLHA ERRADA!!!\n"); system("pause"); } }while(opc != 4); return 0; } void Cadastrar_Projeto(base_projetos cadastro[max]){ system("cls"); printf("----------------------------------------"); printf("\nBEM VINDO AO CADASTRO DE PRODUTOS"); printf("\n----------------------------------------"); char resp = 's'; int resps = 0; while(resp == 's' && pos <= max){ pos++; printf("\nCÓDIGO: %d", pos); cadastro[pos].cod = pos; printf("\nINFORME O NOME DO PROJETO:\n"); fflush(stdin); gets(cadastro[pos].nome); printf("\nINFORME O STATUS DO PROJETO:\n"); printf("[1] - A FAZER FAZENDO [2] - FAZENDO [3] CONCLUÍDO:\n"); printf("R: "); scanf("%d", &resps); switch(resps){ case 1: cadastro[pos].status = 1; break; case 2: cadastro[pos].status = 2; break; case 3: cadastro[pos].status = 3; break; default: printf("\nESCOLHA ERRADA!!!\n"); system("Pause"); } if(pos < max){ printf("\n\nDESEJA CADASTRAR NOVO PROJETO? [s] SIM [n] NÃO\n"); printf("R: "); fflush(stdin); scanf("%c", &resp); system("cls"); }else{ printf("\nSUA BASE DE DADOS JÁ CHEGOU AO LIMITE!!!\n"); resp = 'n'; } } } void Buscar_Projeto(base_projetos cadastro[max]){ system("cls"); int cod, achou; printf("----------------------------------------"); printf("\n BUSCAR PROJETO"); printf("\n----------------------------------------"); printf("\n\nBUSCAR POR CÓDIGO:\n"); scanf("%d", &cod); fflush(stdin); achou = 0; int j = 0; while((achou == 0) && (j <= pos)){ if(cod == cadastro[j].cod){ printf("\nCÓDIGO: %d",cadastro[j].cod); printf("\nNOME: %s\n",cadastro[j].nome); printf("STATUS: "); if(cadastro[j].status == 1){ printf("A FAZER FAZENDO\n"); } if(cadastro[j].status == 2){ printf("FAZENDO\n"); } if(cadastro[j].status == 3){ printf("CONCLUÍDO\n"); } achou = 1; system("pause"); } j++; } if(achou == 0){ printf("\nREGISTRO NÃO ESCONTRADO COM O CÓDIGO %d \n", cod); system("pause"); } } void Listar_Projeto(base_projetos cadastro[max]){ system("cls"); int BuscaStatus,achou,i; printf("------------------------------------------"); printf("\n LISTAR PROJETOS"); printf("\n------------------------------------------\n\n"); printf("QUAL DESEJA LISTAR?"); printf("\n[1] A FAZER FAZENDO [2] FAZENDO [3] CONCLUÍDO\n"); scanf("%d", &BuscaStatus); fflush(stdin); i = 0; achou=0; system("pause"); system("Pause"); } >

Sobre o Clube do Hardware

No ar desde 1996, o Clube do Hardware é uma das maiores, mais antigas e mais respeitadas comunidades sobre tecnologia do Brasil. Leia mais

Direitos autorais

Não permitimos a cópia ou reprodução do conteúdo do nosso site, fórum, newsletters e redes sociais, mesmo citando-se a fonte. Leia mais

×
×
  • Criar novo...

 

GRÁTIS: ebook Redes Wi-Fi – 2ª Edição

EBOOK GRÁTIS!

CLIQUE AQUI E BAIXE AGORA MESMO!