Need some changes with function (C++)

Hi! I 'm new here. Well, i have some problems with my code. First of all, i speak spanish, so i might need to apologize if my english is not very good (also some parts of the code is in spanish but i'll translate most of the code with the problem). Ok, It seems like the code its working and all, but in the console when it is asking "Everything ok , do you want to continue?" i press 1 and it does not show the "Enter the employee 's salary," again , it prints the results of the function planilla , another thing , it does not calculate anything. For example: igss = 500 + a * 0.0483, it needs to be 24.2949 if i insert 3 for the salary, but in the console shows 500, and the other process in function doesn't works too! "... Please, anyone would give me the solution for my code? I will thank you!!
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
#include <iostream>
#include <conio.h>
#include <windows.h>
using namespace std;

//FUNCTION PLANILLA
void planilla(int a){

float counter;
float liquido;
float descuentoTotal;
float igss;
int i;

//COUNTER OF THE EMPLOYEE'S ENTRY'S.
	for (i=0; i<=a; i++);{
	counter = i;
   }

//PROCESS
   descuentoTotal = 500+a*0.0983;
   igss = 500+a*0.0483;
   liquido = 500-descuentoTotal;


//PRINTS THE RESULTS OF THE PROCESS

	textcolor(15);
	gotoxy(24,11); cprintf("EMPLOYEE'S ENTRY'S "); cout << counter;
   textcolor(15);
	gotoxy(24,13); cprintf("Liquido total: "); cout << liquido;
   textcolor(15);
	gotoxy(24,15); cprintf("Descuentos total: "); cout << descuentoTotal;
   textcolor(15);
	gotoxy(24,17); cprintf("IGSS total: "); cout << igss;

}

int sueldo;    //GLOBAL INT VARIABLES
int opcion;
int sueldoNuevo;

int main(){

gotoxy(24,4); cprintf("Acumulo las planillas para ti");
textcolor(15);
gotoxy(24,6); cprintf("Enter the employee's salary: ");
cin >> sueldo;
textcolor(15);
gotoxy(24,8); cprintf("Everything ok, do you want to continue?");
textcolor(15);
gotoxy(24,9); cprintf("1 = Yes, 2 = No ");
cin >> opcion;
if (opcion == 1){
while (opcion != 1){
clrscr();
//IF OPCION IS 1, PRINTS THE HEADER AGAIN WITH A WHILE
gotoxy(24,4); cprintf("Acumulo las planillas para ti");
textcolor(15);
gotoxy(24,6); cprintf("Enter the employee's salary ");
cin >> sueldoNuevo;
sueldo = sueldo+sueldoNuevo;
planilla (sueldo);
textcolor(15);
gotoxy(24,8); cprintf("Everything ok, do you want to continue?");
textcolor(15);
gotoxy(24,9); cprintf("1 = Yes, 2 = No ");
cin >> opcion;
}
}

//CALL FUNCTION PLANILLA
planilla (sueldo);

getch();
return 0;
}

Last edited on
Quite possibly line 55 should be:
while (opcion == 1){
Topic archived. No new replies allowed.