Advertisement
Guest User

main.c

a guest
May 22nd, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.42 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. /* run this program using the console pauser or add your own getch, system("pause") or input loop */
  5.  
  6. int main(int argc, char *argv[])
  7. {
  8.     system("color A");
  9.  
  10.     int cat = 0, sueldo = 0;
  11.     int count1 = 0, count2 = 0, count3 = 0, count4 = 0, countst = 0, counts1 = 0;
  12.     int i, max = 0;
  13.     char nombre[30];
  14.  
  15.     for (i = 1; i <= 4; i++)
  16.     {
  17.         do
  18.         {
  19.             printf("Ingrese nombre, sueldo y categoria:");
  20.             scanf("%s %d %d", &nombre, &sueldo, &cat);
  21.  
  22.             switch (cat)
  23.             {
  24.             case 1:
  25.                 count1++;
  26.                 if (sueldo > 1000)
  27.                 {
  28.                     counts1++;
  29.                 }
  30.                 break;
  31.             case 2:
  32.                 count2++;
  33.                 break;
  34.             case 3:
  35.                 count3++;
  36.                 break;
  37.             case 4:
  38.                 count4++;
  39.                 break;
  40.             default:
  41.                 printf("Categoria incorrecta\n");
  42.                 break;
  43.             }
  44.             if (sueldo > 2000)
  45.             {
  46.                 countst++;
  47.             }
  48.             if (sueldo > max)
  49.             {
  50.                 max = sueldo;
  51.             }
  52.         } while (cat != 1 && cat != 2 && cat != 3 && cat != 4);
  53.     }
  54.     printf("\nCategoria 1\n");
  55.     printf("Empleados:%d\n", count1);
  56.     printf("Cantidad de sueldo mayores $1000:%d\n", counts1);
  57.     printf("\nCategoria 2\n");
  58.     printf("Empleados:%d\n", count2);
  59.     printf("\nCategoria 3\n");
  60.     printf("Empleados:%d\n", count3);
  61.     printf("\nCategoria 4\n");
  62.     printf("Empleados:%d\n", count4);
  63.     printf("\n");
  64.     printf("\nCantidad de empleados que cobran mas de $2000:%d", countst);
  65.     printf("\n");
  66.     printf("Sueldo max: %s %d", nombre, max);
  67.     return 0;
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement