Question: write an assembly program to create the following sample output ------------------------7-11 Convenient Store------------------------ Drinks Soda(S)..........................$2.25 Water(W).........................$1.75 Sandwiches 10inch...........................$3.45 12inch...........................$5.25 How many drinks? 2 What kind

write an assembly program to create the following sample output

"------------------------7-11 Convenient Store------------------------"

Drinks

Soda(S)..........................$2.25

Water(W).........................$1.75

Sandwiches

10inch...........................$3.45

12inch...........................$5.25

How many drinks? 2

What kind of drink? (S=Soda, W=Water)? s

How many sandwiches? 3

What kind of sandwich? (10/12 inches)? 10

your total bill = xx.xx

.

.

.

this is my code but im getting the wrong result , can you help me fix it ?

.

.

#include

#include

using namespace std;

const float soda = 2.25, water = 1.75, tenInch = 3.45, twelveInch = 5.25;

float numDrinks, numSand, sSize,total;

char drink;

void displayMenu()

{

cout << "------------------------7-11 Convenient Store------------------------ ";

cout << "Drinks: ";

cout << "\tSoda(S)..........................$2.25 ";

cout << "\tWater(W).........................$1.75 ";

cout << "Sandwiches: ";

cout << "\t10inch...........................$3.45 ";

cout << "\t12inch...........................$5.25 ";

}

void readData()

{

cout << "\tHow many drinks? ";

cin >> numDrinks;

cout << "\tWhat kind of drink? (S=Soda, W=Water): ";

cin >> drink;

cout << "\tHow many sandwiches? ";

cin >> numSand;

cout << "\tWhat kind of sandwich? (10/12 inches): ";

cin >> sSize;

}

int main()

{

displayMenu();

readData();

_asm

{

fld numDrinks;

Soda:

cmp drink, 'S';

jne Water;

fld soda;

fmul;

jmp Sandwich;

Water:

fld water;

fmul;

Sandwich:

fld numSand;

Ten:

cmp sSize, 10;

jne Twelve;

fld tenInch;

fmul;

jmp Done;

Twelve:

fld twelveInch;

fmul;

Done:

fadd;

fstp total;

}

cout << fixed<< showpoint<< setprecision(2);

cout << "Total: $" << total << endl;

system("pause");

return 0;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!