Agenda Eletronica
Publicado por Cristiano Franco 02/04/2007
[ Hits: 11.472 ]
Script de agenda Eletronica em C++
#include<stdio.h> #include<stdlib.h> #include<conio.h> #include<string.h> void inserir(void); void mostrar(void); void excluir(void); int i; struct registro { char nome[15]; char end[30]; char tel[30]; char mail[5]; }; struct registro vetor[10]; int num; int main(void) { printf("**** **** * **** ******** * ***** *** * *****\n"); printf("* * * * * * * * * * * * * *\n"); printf("* **** * **** * * ***** * * * * *\n"); printf("* * * * * * * * * * * * * *\n"); printf("**** * * * **** * * * * * *** *****\n\n"); for(; ;) { printf("\t\t\t\tAgenda Eletronica\n\n"); printf(" |-----------------------|\n"); printf(" |1-Para adicionar dados | \n"); printf(" |2-Para mostrar dados |\n"); printf(" |3-Para excluir dados |\n"); printf(" |0- Sair |\n"); printf(" |-----------------------|\n\n"); scanf("%d",&num); switch(num) { case 1: inserir(); break; case 2: mostrar(); break; case 3: excluir(); break; case 0: exit(0); default: puts("TENTE NOVAMENTE"); } } getchar(); } void inserir (void) { int vl; printf("Deseja incluir quantas pesoas?"); scanf("%d",&vl); for(i=0; i<vl; i++) { fflush(stdin); printf("\n\n\nNome: "); gets(vetor[i].nome); fflush(stdin); printf("Endereço: "); gets(vetor[i].end); fflush(stdin); printf("Telefone:"); gets(vetor[i].tel); fflush(stdin); printf("E-mail:"); gets(vetor[i].mail); fflush(stdin); } getche(); } void mostrar(void) { int i,vl; printf("Digite a quantidade de pessoas que vc inseriu"); scanf("%d",&vl); for(i=0; i<vl; i++) { printf("\n Nome: %s",vetor[i].nome); printf("\n Endereço: %s",vetor[i].end); printf("\n Telefone: %s",vetor[i].tel); printf("\n E-mail: %s",vetor[i].mail); } } void excluir(void) { char nome[50]; printf("Qual o nome do aluno q vc deseja remover?\n"); scanf("%s",nome); for(i=0; i<10; i++) { if ((strcmp(nome,vetor[i].nome))==0) for( ; i<9; i++) { strcpy(vetor[i].nome,vetor[i+1].nome); strcpy(vetor[i].end,vetor[i+1].end); strcpy(vetor[i].tel,vetor[i+1].tel); strcpy(vetor[i].mail,vetor[i+1].mail); } } getche(); }
Programa CONSULTA/ PESQUISA/ ADICIONA/ EXCLUI registros em arquivos
leitura/escrita de dados/estruturas em arquivo
Automatizando digitação de códigos 2FA no browser
Resolver problemas de Internet
Como compartilhar a tela do Ubuntu com uma Smart TV (LG, Samsung, etc.)
Como converter imagens PNG/JPEG para SVG em linha de comando
Fez porcaria no teu repositório Git? Aprenda a restaurar uma versão anterior do seu código!
Restaurando Fontes de Download do Hydra no Linux
Atualizando "na marra" o YT-DLP quando começa a dar erro de downloads
Como instalar o WPS com interface e corretor ortográfico em PT-BR no Arch Linux
Como desativar notificações de jogos de azar (0)
Jogos baixados na Central de Aplicativos mas que não abrem (1)