Dev - C++ - Me ayudan con unos apuntadores

 
Vista:
sin imagen de perfil
Val: 33
Ha disminuido su posición en 4 puestos en Dev - C++ (en relación al último mes)
Gráfica de Dev - C++

Me ayudan con unos apuntadores

Publicado por Jorge (24 intervenciones) el 28/04/2020 17:33:56
Bueno debo hacer un programa que evalue el sueldo de unos empleados guardados en una estructura y les agrege un bono N dependiendo de si vendieron lo suficiente de un minimo de ventas V, ademas de tomar en cuenta las horas extras H, si alcanzo un maximo de horas extra M dar solo la mitad del bono(SI ALCANZO EL MAXIMO DE HORAS PERO NO EL MINIMO DE VENTAS DAR BONO IGUAL) , imprima el total en usado en IVA, BONOS, BONOSP Y BONOSN, HORAS EXTRA Y TOTAL NETA de cada empleado y toda su suma agregando la hora extra por mes H y el minimo de ventas V en la misma salida.

Ya lo hice compila y todo pero hay un problema con los apuntadores por que la parte del sueldo las horas extras y el iva me saca cantidades muy grandes o desconocidas de la memoria y no se que sucede la sintaxis esta bien pero no llevo mucho trabajando apuntadores asi que no se que pasa bien ..

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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#include <stdio.h>
#include <iostream>
#include <conio.h>
 
 
struct Empleados{
	char empleado[20];
	int bonosN;
	int bonosP;
	int HorasE;
	float sueldo;
	float IVA;
	float sueldoO;
}E1[50],AUX;
 
int pedirEmpleados(float *IVA,float *TOTAL_HORAS,float *TOTA_NETOL,float *TOTAL_BONO,float *TOTAL_BONOSP,float *TOTAL_BONOSN,float HORA,float MINIMOV,float IVA2,float BONO, float MAXH);
void ordenarEmpleados(int EMP);
 
main()
{
	float IVA=0.16,Bono=1000,MinimoVentas=5000,HoraE=50,MAX_HORAS=2500;
	float TOTAL_IVA=0,TOTAL_BONO=0,TOTAL_HORAS=0,TOTAL_NETO,TOTAL_BONOP=0,TOTAL_BONON=0;
	int TAMANO_EMPLEADOS=0,a=0;
	bool BONOR=false;
	char SI[]={"SI"},NO[]={"NO"};
	TAMANO_EMPLEADOS=pedirEmpleados(&TOTAL_IVA,&TOTAL_HORAS,&TOTAL_NETO,&TOTAL_BONO,&TOTAL_BONOP,&TOTAL_BONON,HoraE,MinimoVentas,IVA,Bono,MAX_HORAS);
 
	printf("\t 1- NOMBRE \t 2- SUELDO \t 3- HORAS EXTRA \t 4- BONOS POSITIVOS \t 5- BONOS NEGATIVOS \t 6- IVA \t 7- TOTAL \n");
	putchar('\n');
	for(a=0;a<=TAMANO_EMPLEADOS;a++)
	{
	if(E1[a].sueldoO>=MinimoVentas) printf("\t 1- %s \t 2- %f \t 3- %f \t 4- %s \t 5- %s \t 6- %f \t 7- %f \n \n",E1[a].empleado,E1[a].sueldo,E1[a].HorasE,SI,NO,E1[a].IVA,E1[a].sueldoO); //LOS IF SON PARA SABER SI HAY BONO O NO
	if(E1[a].sueldoO<MinimoVentas) printf("\t 1- %s \t 2- %f \t 3- %f \t 4- %s \t 5- %s \t 6- %f \t 7- %f \n \n",E1[a].empleado,E1[a].sueldo,E1[a].HorasE,NO,SI,E1[a].IVA,E1[a].sueldoO);
    }
	printf("\t DINERO TOTAL EN IVA: %f \n \t DINERO TOTAL EN HORAS EXTRA: %f \n \t DINERO TOTAL EN BONOS POSITIVOS: %f \n \t DINERO TOTAL EN BONOS NEGATIVOS: %f \n \t DINERO TOTAL EN BONOS: %f \n \n",TOTAL_IVA,TOTAL_HORAS,TOTAL_BONOP,TOTAL_BONON,TOTAL_BONO);
	printf("\t MINIMO DE VENTAS PARA EL MES: %f \n \t VALOR DE HORA EXTRA DEL MES: %f \n \n \t DINERO TOTAL USADO: %f \n \n",MinimoVentas,HoraE,TOTAL_NETO);
 
}
 
int pedirEmpleados(float *IVA,float *TOTAL_HORAS,float *TOTAL_NETO,float *TOTAL_BONO,float *TOTAL_BONOP,float *TOTAL_BONON,float HORA,float MINIMOV,float IVA2,float BONO, float MAXH)
{
	int MaxEmpleados=1000,a=0;
	char resp;
 
	for(a=0;a<MaxEmpleados;a++)
	{
		printf("Ingresa el nombre del empleado: \t %d \n",a+1);
		gets(E1[a].empleado);
		putchar('\n');
		fflush(stdin);
		printf("Ingresa el sueldo del empleado: \t %d \n",a+1);
		scanf("%f",&E1[a].sueldo);
		putchar('\n');
		printf("¿Cuantas horas extras trabajo? \n");
		scanf("%f",&E1[a].HorasE);
		putchar('\n');
 
		E1[a].sueldoO=E1[a].sueldo; //GUARDA EL SUELDO ORIGINAL
		if(E1[a].sueldo>MINIMOV) //COMPARA SUELDO CON MINIMO DE VENTAS PARA BONO
		{
			E1[a].sueldo=E1[a].sueldo+BONO;
			*TOTAL_BONO+=BONO;
			*TOTAL_BONOP+=BONO;
		} else {
		E1[a].sueldo=E1[a].sueldo-BONO;
		*TOTAL_BONON+=BONO;
		*TOTAL_BONO+=(-BONO); //REVISAR *TOTAL_BONO=+(-BONO);
	}
		if(((E1[a].HorasE)*HORA)>=MAXH) //COMPARA HORAS EXTRAS PARA DAR EL BONO A LA MITAD
		{
			if(E1[a].sueldo>=MINIMOV)
			{
				E1[a].sueldo=E1[a].sueldo+(BONO/2)-BONO;
				*TOTAL_BONOP=(BONO/2)-BONO;
				*TOTAL_BONO=(BONO/2)-BONO;
			 } else{
			 E1[a].sueldo=E1[a].sueldo+(BONO/2);
			 *TOTAL_BONO+=(BONO/2)-BONO;
			 *TOTAL_BONON+=(BONO/2);
		     }
		}
		*TOTAL_HORAS+=(E1[a].HorasE*HORA);  //AGREGA LAS HORAS EXTRA AL SUELDO YA CON EL
// AGREGADO O NO
		E1[a].sueldo=E1[a].sueldo + (E1[a].HorasE*HORA);
		*IVA+=(E1[a].sueldo-(E1[a].sueldo*IVA2));
		E1[a].IVA=E1[a].sueldo-(E1[a].sueldo*IVA2);
		E1[a].sueldo=E1[a].sueldo*(IVA2);
		*TOTAL_NETO+=E1[a].sueldo;
		fflush(stdin);
		printf("Quieres seguir introduciendo Informacion? \t S-N \n");
		scanf("%c",&resp);
		fflush(stdin);
		if(resp!='s')
		{
			return a;
			break;
		}
	}
}
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder