Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- struct Contato
- {
- char nome [80];
- char fone [14];
- } agenda[50];
- int qtd = 0;
- void menu ();
- void adicionarContatos();
- void exibeContatos();
- int main(int argc, char** argv)
- {
- int i = 1;
- int opcao;
- while(i == 1)
- {
- system("cls");
- menu();
- scanf(" %d", &opcao);
- fflush(stdin);
- switch(opcao)
- {
- case 1:
- adicionarContatos();
- break;
- case 2:
- // removeContatos();
- break;
- case 3:
- exibeContatos();
- break;
- case 0:
- exit(0);
- break;
- }
- }
- return 0;
- }
- void menu ()
- {
- printf("1. ADICIONAR CONTATO\n");
- printf("2. REMOVER CONTATO\n");
- printf("3. EXIBIR CONTATO\n");
- printf("0. SAIR\n");
- printf("-->");
- }
- void adicionarContatos()
- {
- printf ("Nome: ");
- fgets(agenda[qtd].nome, 81, stdin);
- printf("Fone: ");
- fgets(agenda[qtd].fone, 15, stdin);
- qtd++;
- }
- void remove ()
- {
- }
- void exibeContatos()
- {
- int i;
- for( i = 0; i < qtd; i++)
- {
- printf("Nome: %s", agenda[i].nome);
- printf("Fone: %s\n", agenda[i].fone);
- printf("\n");
- }
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement