Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <conio.h>
- #include <string.h>
- #include <stdlib.h>
- int main(){
- char CPF[12], NOME[20], SOBRENOME[40], CARGO[20];
- float VH, NH, PD, SB, TD, SL;
- do{
- printf("Informe seu CPF (Somente numeros): ");
- gets(CPF);
- }while(strlen(CPF) >= 12);
- do{
- printf("Informe seu nome: ");
- gets(NOME);
- }while(strlen(NOME) >= 20);
- do{
- printf("Informe seu sobrenome: ");
- gets(SOBRENOME);
- }while(strlen(SOBRENOME) >= 40);
- do{
- printf("Informe seu cargo: ");
- gets(CARGO);
- }while(strlen(CARGO) >= 20);
- printf("Informe o valor por hora (Em R$): ");
- scanf("%f", &VH); fflush(stdin);
- printf("Informe o numero de horas trabalhadas: ");
- scanf("%f", &NH); fflush(stdin);
- printf("Informe o percentual de desconto: ");
- scanf("%f", &PD); fflush(stdin);
- system("cls");
- if((VH > 0.0) && (NH > 0.0) && (PD >= 0.0)){
- printf("Relatorio de funcionario.\n");
- printf("\nFuncionario: \t %s %s\n", NOME, SOBRENOME);
- printf("CPF:\t\t %s\n", CPF);
- printf("Cargo:\t\t %s\n", CARGO);
- printf("Valor/HR:\t R$ %.2f\n", VH);
- SB = VH * NH;
- printf("Salario Bruto:\t R$ %.2f\n", SB);
- TD = (SB * PD) / 100.0;
- printf("Descontos:\t R$ %.2f\n", TD);
- SL = SB - TD;
- printf("Salario Liquido: R$ %.2f\n\n", SL);
- }else{
- printf("Valores de entrada devem ser maiores do que zero, exceto o percentual de desconto que pode ser zero.\n\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment