Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* 2) Faça um programa cadastre um funcionário usando os seguintes registros.
- Type Endereço
- Rua Número Bairro
- String[40] Integer String[20]
- Após a leitura dos dados, imprima os valores na tela */
- #include <stdio.h>
- #include <conio.h>
- typedef struct
- {
- int numero;
- char rua[20], bairro[20];
- }endereco;
- typedef struct
- {
- char nome[20];
- int matricula;
- endereco ende;
- }funcionario;
- main ()
- {
- funcionario func;
- printf ("\n Nome:");
- fflush (stdin);
- gets (func.nome);
- printf ("\n Matricula:");
- scanf ("%d", &func.matricula);
- printf ("\n Endereco: \n Rua:");
- fflush (stdin);
- gets (func.ende.rua);
- printf ("\n Bairro:");
- fflush (stdin);
- gets (func.ende.bairro);
- printf ("\n Numero:");
- scanf("%d", &func.ende.numero);
- printf("\n \n");
- printf ("\n Nome:");
- puts (func.nome);
- printf ("\n Matricula: %d", func.matricula);
- printf ("\n Endereco: \n Rua:");
- puts (func.ende.rua);
- printf ("\n Bairro:");
- puts (func.ende.bairro);
- printf ("\n Numero: %d", func.ende.numero);
- getch ();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement