luishenriique

Relatorio Funcionario

Mar 28th, 2012
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.41 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <conio.h>
  3. #include <string.h>
  4. #include <stdlib.h>
  5.  
  6. int main(){
  7.     char CPF[12], NOME[20], SOBRENOME[40], CARGO[20];
  8.     float VH, NH, PD, SB, TD, SL;
  9.  
  10.     do{
  11.         printf("Informe seu CPF (Somente numeros): ");
  12.         gets(CPF);
  13.     }while(strlen(CPF) >= 12);
  14.  
  15.     do{
  16.         printf("Informe seu nome: ");
  17.         gets(NOME);
  18.     }while(strlen(NOME) >= 20);
  19.  
  20.     do{
  21.         printf("Informe seu sobrenome: ");
  22.         gets(SOBRENOME);
  23.     }while(strlen(SOBRENOME) >= 40);
  24.  
  25.     do{
  26.         printf("Informe seu cargo: ");
  27.         gets(CARGO);
  28.     }while(strlen(CARGO) >= 20);
  29.  
  30.     printf("Informe o valor por hora (Em R$): ");
  31.     scanf("%f", &VH); fflush(stdin);
  32.     printf("Informe o numero de horas trabalhadas: ");
  33.     scanf("%f", &NH); fflush(stdin);
  34.     printf("Informe o percentual de desconto: ");
  35.     scanf("%f", &PD); fflush(stdin);
  36.  
  37.     system("cls");
  38.  
  39.     if((VH > 0.0) && (NH > 0.0) && (PD >= 0.0)){
  40.         printf("Relatorio de funcionario.\n");
  41.         printf("\nFuncionario: \t %s %s\n", NOME, SOBRENOME);
  42.         printf("CPF:\t\t %s\n", CPF);
  43.         printf("Cargo:\t\t %s\n", CARGO);
  44.         printf("Valor/HR:\t R$ %.2f\n", VH);
  45.  
  46.         SB = VH * NH;
  47.  
  48.         printf("Salario Bruto:\t R$ %.2f\n", SB);
  49.  
  50.         TD = (SB * PD) / 100.0;
  51.  
  52.         printf("Descontos:\t R$ %.2f\n", TD);
  53.  
  54.         SL = SB - TD;
  55.  
  56.         printf("Salario Liquido: R$ %.2f\n\n", SL);
  57.     }else{
  58.         printf("Valores de entrada devem ser maiores do que zero, exceto o percentual de desconto que pode ser zero.\n\n");
  59.     }
  60.     return 0;
  61. }
Advertisement
Add Comment
Please, Sign In to add comment