why does it wont show the result after 'Status'?

It goes right until status and then it wont show the next output.Whats wrong with my code?

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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
  #include<iostream>
#include<string>
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<windows.h>
using namespace std;

char nama[20], gol[10], status[20];
int gapok,tunja,x,gaji;
float prosen,potong;


int main()
{	char nama[20], a[10], b[20];
	cout<<"===PROGRAM PENGHITUNG GAJI KARYAWAN==="<<endl;
	cout<<"Nama Karyawan  \t	:"; cin>>nama;
	cout<<"Golongan (A/B) ?\t:"; cin>>a;
	cout<<"\nStatus (Nikah/Belum)\t:"; cin>>b;
}
int print ()
{ char a[10],b[20];
cout<<"Anda merupakan golongan"<<a<<"dan status anda adalah"<<b<<endl;
}
void gaji_pokok(char gol[10])
{
	
	if (stricmp("A",gol)==0)
		{gapok=2000000;
			cout<<"Gaji Pokok:Rp "<<gapok<<",00";}
	else
		{gapok=3000000;	
		cout<<"Gaji Pokok	:Rp "<<gapok<<",00";}
}

void tunjangan(char gol[10], char status[20])
{

	if ((stricmp("a",gol)==0) && (stricmp("nikah",status)==0))
	
		{tunja=100000;
		
	cout<<"Tunjangan		:Rp "<<tunja<<",00";}
	else if ((stricmp("a",gol)==0) && (stricmp("belum",status)==0))
	
		{
		tunja=50000;
		cout<<"Tunjangan		:Rp "<<tunja<<",00";}
	
	else if ((stricmp("b",gol)==0) && (stricmp("nikah",status)==0))
	
		{
		tunja=150000;
		cout<<"Tunjangan		:Rp "<<tunja<<",00";
}
	else if ((stricmp("b",gol)==0) && (stricmp("belum",status)==0))
	

		{
				tunja=110000;
		cout<<"Tunjangan		:Rp "<<tunja<<",00";}
	else {cout<<"error";}
	
}
void prosentase(char gol[10],char status[20])
{
		if (stricmp("A",gol)==0)
		{gapok=2000000;}
	else
		{gapok=3000000;}
		//jarak 
		if ((stricmp("a",gol)==0) && (stricmp("nikah",status)==0))
	
		{tunja=100000;}
	
	else if ((stricmp("a",gol)==0) && (stricmp("belum",status)==0))
	
		{tunja=50000;}
	
	else if ((stricmp("b",gol)==0) && (stricmp("nikah",status)==0))
	
		{tunja=150000;}
	
	else if ((stricmp("b",gol)==0) && (stricmp("belum",status)==0))
	
		{tunja=110000;}
	else {cout<<"error";}
	//jarak
	x=gapok+tunja;
	if (x<=2500000)
	{
		{prosen=0.05;
		cout<<"\nProsentase="<<prosen<<endl;
		}
	}
	else if(x>3000000)
	{
		{
		prosen=0.1;
			cout<<"\nProsentase="<<prosen<<endl;
		}
	}
}
void potongan_iuran(char gol[10],char status[20])
{
		if (stricmp("A",gol)==0)
		{gapok=2000000;}
	else
		gapok=3000000;
		//jarak 
		if ((stricmp("a",gol)==0) && (stricmp("nikah",status)==0))
	
		{tunja=100000;}
	
	else if ((stricmp("a",gol)==0) && (stricmp("belum",status)==0))
	
		{tunja=50000;}
	
	else if ((stricmp("b",gol)==0) && (stricmp("nikah",status)==0))
	
		{tunja=150000;}
	
	else if ((stricmp("b",gol)==0) && (stricmp("belum",status)==0))
	
		{tunja=110000;}
	else {cout<<"error";}
	//jarak
	x=gapok+tunja;
	if (x<=2500000)
	{
		potong=x*0.05;
			cout<<"\nPersen pemotongan	:"<<potong;
	}
	else if(x>3000000)
	{
		potong=x*0.1;
			cout<<"\nPersen pemotongan	:"<<potong;
	}
	

}
void gaji_bersih(char gol[10],char status[20])
{
		if (stricmp("A",gol)==0)
		{gapok=2000000;}
	else
		{gapok=3000000;}
		//jarak 
		if ((stricmp("a",gol)==0) && (stricmp("nikah",status)==0))
	
		{tunja=100000;}
	
	else if ((stricmp("a",gol)==0) && (stricmp("belum",status)==0))
	
		{tunja=50000;}
	
	else if ((stricmp("b",gol)==0) && (stricmp("nikah",status)==0))
	
		{tunja=150000;}
	
	else if ((stricmp("b",gol)==0) && (stricmp("belum",status)==0))
	
		{tunja=110000;}
	else {cout<<"error";}
	//jarak
	x=gapok+tunja;
	if (x<=2500000)
	{
		gaji=x-(x*0.05);
		cout<<"\nGaji Bersih:Rp "<<gaji<<",00";
	}
	else if(x>3000000)
	{
		gaji=x-(x*0.1);
		cout<<"\nGaji Bersih:Rp "<<gaji<<",00";
}}
This is the entry point to your application, main:

1
2
3
4
5
6
7
int main()
{	char nama[20], a[10], b[20];
	cout<<"===PROGRAM PENGHITUNG GAJI KARYAWAN==="<<endl;
	cout<<"Nama Karyawan  \t	:"; cin>>nama;
	cout<<"Golongan (A/B) ?\t:"; cin>>a;
	cout<<"\nStatus (Nikah/Belum)\t:"; cin>>b;
}


You do not call any of your functions from your main function.

Suggest reading:
http://www.cplusplus.com/doc/tutorial/functions/

Also, you will help yourself and others reading your code if you practiced proper code indentation and spacing.

1
2
3
4
5
6
7
8
9
10
11
12
		if (stricmp("A",gol)==0)
		{gapok=2000000;}
	else
		{gapok=3000000;}
		//jarak 
		if ((stricmp("a",gol)==0) && (stricmp("nikah",status)==0))
	
		{tunja=100000;}
	else if ((stricmp("a",gol)==0) && (stricmp("belum",status)==0))
	
		{tunja=50000;}
	

Is very misleading, indentation-wise.
Better would be:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
	if (stricmp("A",gol) == 0) { 
		gapok = 2000000;
	}
	else {
		gapok = 3000000;
	}

	//jarak 
	if ((stricmp("a",gol)==0) && (stricmp("nikah",status)==0)) {
		tunja = 100000;
	}
	else if ((stricmp("a",gol)==0) && (stricmp("belum",status)==0)) {
		tunja = 50000;
	}
	
Last edited on
1
2
3
4
5
6
7
int main()
{	char nama[20], a[10], b[20];
	cout<<"===PROGRAM PENGHITUNG GAJI KARYAWAN==="<<endl;
	cout<<"Nama Karyawan  \t	:"; cin>>nama;
	cout<<"Golongan (A/B) ?\t:"; cin>>a;
	cout<<"\nStatus (Nikah/Belum)\t:"; cin>>b;
}


There is no next output. "Status (Nikah/Belum)" is output, then you enter a value for b, then the program is finished. I see that you wrote some other functions, but you're not using them.
Last edited on
Topic archived. No new replies allowed.