-
Notifications
You must be signed in to change notification settings - Fork 0
/
p5.cpp
60 lines (47 loc) · 1.3 KB
/
p5.cpp
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
#include <iostream>
#include <cstdlib>
using namespace std;
int tipeData();
int login();
int main()
{
// tipeData();
login();
return 0;
}
int tipeData()
{
// tipe data
unsigned int a{20U}; // untuk memasukkan nilai unsigned harus berakhiran U
long b{8811L}; // unutk memasukkan nilai long harus berakhiran L
unsigned long c{1235321UL}; // unutk memasukkan nilai unsigned long harus berakhiran UL
unsigned long long d{21332213452ULL}; // unutk memasukkan nilai unsigned long long harus berakhiran ULL
// tipe data biner
int e{0b00000110}; // awalan 0b untuk biner
int f{0377}; // awalan 0 untuk oktal
int g{255}; // tidak menggunakan awalan desimal
int h{0x1111a111}; // awalan 0x untuk heksadesimal
cout << "a = " << a << "\nb = " << b << "\nc = " << c << "\nd = " << d
<< "\ne = " << e << "\nf = " << f << "\ng = " << g << "\nh = " << h << endl;
return 0;
}
int login()
{
unsigned int pin;
unsigned int j{0};
do
{
cout << "masukkan pin = ";
cin >> pin;
j++;
} while (j < 3 && pin != 12345U);
if (j == 3)
{
cout << "kesempatan anda habis!!" << endl;
exit(1);
}
cout << "anda berhasil login!!\n"
<< endl;
tipeData();
return 0;
}