-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA7Q3.cpp
More file actions
104 lines (78 loc) · 1.98 KB
/
A7Q3.cpp
File metadata and controls
104 lines (78 loc) · 1.98 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
#include <iostream>
#include <iomanip>
using namespace std;
float sodaCost = 2.25f, waterCost = 1.75f, tenInchesCost = 3.45f, twelveInchesCost = 5.25f;
float amountDrinks, amountSand;
float totalPrice,temp;
char choiceDrink;
int choiceSand;
void printMenu()
{
cout << "-----------------------------7-11 Convienient Store------------------------------\n";
cout << " Drinks\n\tSoda(S)...................................$2.25\n";
cout << "\tWater(W).....................................$1.75\n";
cout << " Sandwiches\n\t10 inches.............................$3.45\n";
cout << "\t12 inches......................................$5.25\n\n";
}
void getOrder()
{
cout << "How many drinks? ";
cin >> amountDrinks;
cout << "\tWhat kind of drink?(S=Soda, W=Water) ";
cin >> choiceDrink;
cout << "How many Sandwhiches?";
cin >> amountSand;
cout << "\tWhat kind of Sandwhiches?( 10 inces or 12 inches) ";
cin >> choiceSand;
}
void PrintTotal()
{
cout << "Your total bill = " << totalPrice << endl;
}
int main()
{
_asm
{
call printMenu
call getOrder
DrinkType:
fld amountDrinks
mov bl, 'S'
cmp choiceDrink,bl
jne Water
Soda:
fld sodaCost
jmp SandType
Water:
fld waterCost
SandType:
fld amountSand
mov eax, choiceSand
cmp choiceSand,eax
jne Sand12
Sand10:
fld tenInchesCost
fmul; tenInchCost * amountSand
fstp totalPrice; totalPrice = sand cost
fmul; drinkchoice * amount
fstp temp; temp = drink cost
fld totalPrice
fld temp
fadd
fstp totalPrice; totalprice = drinkcost + sand cost
jmp printtotal
Sand12:
fld twelveInchesCost
fmul; ten12Cost * amountSand
fstp totalPrice; totalPrice = sand cost
fmul; drinkchoice * amount
fstp temp; temp = drink cost
fld totalPrice
fld temp
fadd
fstp totalPrice; totalprice = drinkcost + sand cost
printtotal:
call PrintTotal
}
return 0;
}