Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main() {
- int opcao;
- int i = 0;
- struct agenda {
- char nome[100];
- char telefone[20];
- char email[50];
- char sexo;
- int idade;
- float peso;
- float altura;
- } contatos[1000];
- printf(
- "****MENU AGENDA ELETRONICA****\n1: Adicionar contato\n2: Excluir "
- "contato\n3: Pesquisar contato\n4: Visualizar todos os contatos\n0: "
- "Sair!\n");
- scanf("%d", &opcao);
- switch (opcao) {
- case 1:
- setbuf(stdin, NULL);
- // contatos[i].nome[100]
- fgets(contatos[i].nome, 100, stdin);
- setbuf(stdin, NULL);
- // contatos[i].telefone[20]
- fgets(contatos[i].telefone, 20, stdin);
- setbuf(stdin, NULL);
- // contatos[i].email[50]
- fgets(contatos[i].email, 50, stdin);
- setbuf(stdin, NULL);
- // contatos[i].sexo
- scanf("%c", contatos[i].sexo);
- setbuf(stdin, NULL);
- // contatos[i].idade
- scanf("%c", contatos[i].idade);
- setbuf(stdin, NULL);
- // contatos[i].peso
- scanf("%c", contatos[i].peso);
- setbuf(stdin, NULL);
- // contatos[i].altura
- scanf("%c", contatos[i].altura);
- i++;
- break;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement