-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathalteracaoDepont.c
63 lines (56 loc) · 1.11 KB
/
alteracaoDepont.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include <stdio.h>
#include <stdio_ext.h>
#include <stdlib.h>
#define TAM 3
typedef struct{
char nome[50];
int idade;
double salario;
int tempoEmpresa;
}funcionario;
void cadastrar(funcionario *func){
__fpurge(stdin);
puts("Nome: ");
fgets(func->nome, 50, stdin);
puts("Idade: ");
scanf("%d", &func->idade);
puts("Salario: ");
scanf("%lf", &func->salario);
puts("Tempo de Empresa: ");
scanf("%d", &func->tempoEmpresa);
system("clear");
}
void exibir(funcionario f){
system("clear");
printf("Nome: %s", f.nome);
printf("Idade: %d anos\n", f.idade);
printf("Salário: %.2lf\n", f.salario);
printf("Tempo de empresa: %d anos\n", f.tempoEmpresa);
}
int main(){
int op;
funcionario fu;
//funcionario funcionarios[3];
do{
puts("\n\tMENU DOS FUNCIONÁRIOS\n");
puts("1-Cadastrar Funcionario");
puts("2-Exibir Funcionario");
puts("6-Sair");
printf("Opção: ");
scanf("%d", &op);
system("clear");
switch(op){
case 1:
cadastrar(&fu);
break;
case 2:
exibir(fu);
break;
case 6:
break;
default:
puts("Opção inválida!");
break;
}
}while(op!=6);
}