-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPractice3.cpp
More file actions
134 lines (122 loc) · 2.04 KB
/
Practice3.cpp
File metadata and controls
134 lines (122 loc) · 2.04 KB
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
#include <iostream>
#include <iomanip>
using namespace std;
short range, counter, customer, ages;
float total, age;
float maleA = 2.75f, femaleA = 1.10f, maleT = 7.20f, femaleT = 6.15f, maleC = 1.10f, femaleC = 2.00f;
char gender;
void getQ()
{
cout << " Enter the number of customers: ";
cin >> customer;
}
void getdata()
{
cout << "How old are you? " << endl;
cin >> age;
ages = age;
cout << "What is your gender (m/f) ";
cin >> gender;
}
void errorMessage()
{
cout << "Your input is invaild " << endl;
}
void displayResult()
{
cout << fixed << showpoint << setprecision(2);
cout << " your membership is : " << total << endl;
}
int main()
{
_asm
{
call getQ
mov counter, 0
checkage:
mov ax,customer
cmp counter,ax
je done
call getdata
cmp ages,19
jng checkteen
mov range,2
jmp checkm
checkteen:
cmp ages, 13
jng checkch
mov range, 1
jmp checkm;
checkch:
mov range, 0
checkm:
cmp gender,'m'
jne checkmm
jmp compareMrange
checkmm:
cmp gender,'M'
jne checkf
jmp compareMRange
checkf:
cmp gender,'f'
jne checkff
jmp compareFrange
checkff:
cmp gender,'F'
jne errormsg
jmp compareFRange
compareMRange:
cmp range,0
jne compareMRange2
fld age
fld maleC
fmul
fstp total
jmp display
compareMRange2 :
cmp range, 1
jne compareMRange3
fld age
fld maleT
fmul
fstp total
jmp display
compareMRange3 :
fld age
fld maleA
fmul
fstp total
jmp display
compareFRange :
cmp range, 0
jne compareFRange2
fld age
fld femaleC
fmul
fstp total
jmp display
compareFRange2 :
cmp range, 1
jne compareFRange3
fld age
fld femaleT
fmul
fstp total
jmp display
compareFRange3 :
fld age
fld femaleA
fmul
fstp total
jmp display
display:
call displayResult
inc counter
jmp checkage
errormsg:
call errorMessage
jmp checkage
done:
}
return 0;
}