Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Excel As Your Database

Authors: Paul Cornell

1st Edition

1590597516, 978-1590597514

More Books

Students also viewed these Databases questions

Question

What magazine and ads did you choose to examine?

Answered: 1 week ago