stuck need help

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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
#include<iostream>
#include<iomanip>
using namespace std;

class tabungan
{
	double saldo;
	int norek;
	char nama[21];

public :
	tabungan();
	void getnama(char *);
	double getsaldo();
	int getnorek();
	void buat_akun();
	void setoran();
	void penarikan();
	void transfer();
	void cek_saldo();
	void cetak();
}; //akhir class

tabungan nasabah[7];
int jum_akun;

tabungan::tabungan()
{
	saldo=0;
	norek=0;
	strcpy(nama,"NULL");
}

void tabungan::getnama(char *s)
{
	strcpy(s,nama);
}

double tabungan::getsaldo()
{
	return (saldo);
}

int tabungan::getnorek()
{
	return (norek);
}

void tabungan::buat_akun()
{
	do
	{
		cout<<"masukkan jumlah akun yang ingin anda buat [1-5]: ";
		cin>>jum_akun;
		cin.clear();
		cin.sync();
	}while(jum_akun<1 || jum_akun>5);
	for(int i=1;i<jum_akun;i++)
	{
		cout<<"masukkan nama akun"<<i<<" : ";
		cin>>nasabah[i].nama;
		cin.clear();
		cin.sync();
		nasabah[i].norek=i;
		cout<<"nomer rekening akun"<<i<<" : "<<nasabah[i].norek<<endl;
		cout<<"masukkan saldo awal akun "<<i<<" : ";
		cin>>nasabah[i].saldo;
		cin.clear();
		cin.sync();
		cout<<"pembuatan akun "<<i<<" sukses!";
	}
	cout<<jum_akun<<" akun telah selesai di buat!"<<endl;
}

void tabungan::setoran()
{
	int temp;
	double temp2;
	cout<<"masukkan nomer rekening : ";
	cin>>temp;
	cin.clear();
	cin.sync();
	nasabah[temp].norek=temp;
	cout<<nasabah[temp].nama<<" saldo : "<<nasabah[temp].saldo<<endl;
	cout<<"jumlah uang yang ingin di setor : ";
	cin>>temp2;
	cin.clear();
	cin.sync();
	nasabah[temp].saldo+=saldo;
	cout<<"proses sukses!"<<endl
		<<"saldo "<<nasabah[temp].nama<<" sekarang : "<<nasabah[temp].saldo<<endl<<endl<<endl;
}

void tabungan::penarikan()
{
	int i;
	double j;
	cout<<"masukkan nomer rekening : ";
	cin>>i;
	cin.clear();
	cin.sync();
	nasabah[i].norek=i;
	cout<<nasabah[i].nama<<" saldo : "<<nasabah[i].saldo<<endl;
	cout<<"jumlah uang yang ingin  di ambil : ";
	cin>>j;
	cin.clear();
	cin.sync();
	nasabah[i].saldo-=saldo;
	cout<<"proses sukses!"<<endl
		<<"saldo "<<nasabah[i].nama<<" sekarang : "<<nasabah[i].saldo<<endl<<endl<<endl;
}

void tabungan::transfer()
{
	int a;
	double b;
	int c;
	cout<<"masukkan nomer rekening : ";
	cin>>a;
	cin.clear();
	cin.sync();
	nasabah[a].norek=a;
	cout<<nasabah[a].nama<<" saldo : "<<nasabah[a].saldo<<endl;
	cout<<"jumlah uang yang ingin  di transfer : ";
	cin>>b;
	cin.clear();
	cin.sync();
	cout<<"nomer rekening tujuan : ";
	cin>>c;
	cin.clear();
	cin.sync();
	nasabah[a].saldo-=saldo;
	cout<<"proses sukses!"<<endl
		<<"saldo "<<nasabah[a].nama<<" sekarang : "<<nasabah[a].saldo<<endl<<endl<<endl;
}

void tabungan::cek_saldo()
{
	int z;
	cout<<"masukkan nomer rekening : ";
	cin>>z;
	cin.clear();
	cin.sync();
	nasabah[z].norek=z;
	cout<<"jumlah saldo "<<nasabah[z].nama<<" : "<<nasabah[z].saldo;
}

void tabungan::cetak()
{
	cout << endl << endl;
	cout << "|--------------------------|---------------------|----------------------|" << endl;
	cout << "|     Nomer Rekening       |    Nama Nasabah     |         Saldo        |" << endl;
	cout << "|--------------------------|---------------------|----------------------|"<< endl;

	for(int i=1;i<jum_akun;i++)
	{
		cout.setf(ios::left|ios::showpoint);
		cout << "| ";
		cout.width(25);
		cout << nasabah[i].norek;
		cout << "|";
		cout.width(21);
		cout << nasabah[i].nama;
		cout << "|";
		cout.width(23);
		cout << nasabah[i].saldo;
		cout << "|\n";
	 }
}

void main()
{
	tabungan temp;
	int pilihan;
	do
	{
		system("cls");
		cout<<"----------------BANK PNT----------------"
			<<endl
			<<"========================================"
			<<endl<<endl;
		cout<<"1. Buat akun"<<endl
			<<"2. Setoran"<<endl
			<<"3. Penarikan"<<endl
			<<"4. Transfer"<<endl
			<<"5. Cek Saldo"<<endl
			<<"6. Cetak Daftar Nasabah"<<endl
			<<"7. Keluar"<<endl<<endl<<endl
			<<"Masu	kkan Pilihan Anda : ";
		cin>>pilihan;
		cin.clear();
		cin.sync();
	}while(pilihan!=7);

	switch(pilihan)
	{
	case 1:
		temp.buat_akun();
		break;
	case 2:
		temp.setoran();
		break;
	case 3:
		temp.penarikan();
		break;
	case 4:
		temp.transfer();
		break;
	case 5:
		temp.cek_saldo();
		break;
	case 6:
		temp.cetak();
		break;
	case 7:
		cout<<"tekan enter untuk keluar"<<endl<<endl<<endl;
		break;
	default:
		cout<<"masukkan pilihan dengan benar!";
		system("pause");
		break;
	}

	system("pause");
}


statement in every case doesn't print any statement, anybody wanna help me ?
Topic archived. No new replies allowed.