Last active
November 19, 2018 22:45
-
-
Save joaopedro-fg/00ce6520cba0cbb766adccd64d4dd596 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float inserir(FUNCIONARIO* func, float salariotot) | |
{ | |
int numL=0, tmp_len=0; | |
float tmp_sal; | |
char tmp_str[50]; | |
printf("\n" ); | |
printf("%d\n", num_funcionarios); | |
printf("Deseja cadastrar quantos funcionarios?\n"); | |
scanf("%d", &numL); | |
func = (FUNCIONARIO*) realloc(func, (numL+num_funcionarios)*sizeof(FUNCIONARIO)); | |
for(int j=0; j<numL; j++){ | |
setbuf(stdin, NULL); | |
printf(" NOME: "); | |
fgets(tmp_str, 50, stdin); | |
tmp_str[strlen(tmp_str)-1]= '\0'; | |
strcpy(func[num_funcionarios+j].nome, tmp_str); | |
printf(" SALARIO: "); | |
scanf("%f", &tmp_sal); | |
func[num_funcionarios+j].salario=tmp_sal; | |
salariotot=func[num_funcionarios+j].salario+salariotot; | |
custototal=func[num_funcionarios+j].salario+custototal; | |
} | |
num_funcionarios+=numL; | |
for(int q=0; q<5; q++){ | |
printf("%s, %f\n", func[q].nome, func[q].salario ); | |
} | |
return salariotot; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment