File: Money.asm #3 Author: ************ Date: mm/dd/yyyy # Purpose: Practice floating point; Break down cash to bills and coins #- # WRITE MIPS CODE FOR THE FOLLOWING C++ CODE: #3 #include #include #include #using namespace std; float cash; int remainder , twenty, ten, five, one, quarter, dime, nickel, penny; void main() { #3 # # cout <« "Enter amount of cash: "; //enter 56.68 cin >> cash; remainder = (int)(100.0f * cash) //use integers from now on twenty = remainder / 2000; remainder = remainder % 2000; ten = remainder / 1000; remainder = remainder %, 1000; five = remainder / 500; remainder = remainder % 500; one = remainder / 100; remainder = remainder % 100; quarter = remainder / 25; remainder = remainder % 25; dime = remainder % / 10; remainder = remainder % 10; nickel = remainder / 5; penny = remainder % 5; cout # #3 #3 //$20 #3 //$10 # //$5 #3 #3 //$1 #3 #3 //$0.25 2# #3 //$0.10 # //$0.05 //$0.01 #3 <« "\nTwenty \t" « twenty « "\nTen << "\nFive « "\nOne « "\nQuarter \t" « quarter « "\nDime <« "\nNickel \t" << nickel « "\nPenny %23 \t" <« ten \t" <« five \t" << one %23 #3 #3 # \t" <« dime #3 \t" « penny « endl; }//end main(O # SAMPLE OUTPUT: Enter amount of cash (56.68): 56.68 23 23 Twenty # 2 Ten Five One Quarter Dime Nickel #3 # Penny 3

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

7

 

File: Money.asm
# Author: ************
Date: mm/dd/yyyy
# Purpose: Practice floating point; Break down cash to bills and coins
#-
# WRITE MIPS CODE FOR THE FOLLOWING C++ CODE:
#include <iostream>
#include <string>
#include <math.h>
#using namespace std;
float cash;
int remainder , twenty, ten, five, one, quarter, dime, nickel, penny;
void main()
{
#
#
#
cout <« "Enter amount of cash: "; //enter 56.68
cin >> cash;
remainder = (int)(100.0f * cash) //use integers from now on
twenty = remainder / 2000;
remainder = remainder % 2000;
ten = remainder / 1000;
remainder = remainder %, 1000;
five = remainder / 500;
remainder = remainder % 500;
one = remainder / 100:
remainder = remainder % 100;
quarter = remainder / 25;
remainder = remainder % 25;
dime = remainder % / 10;
remainder = remainder % 10;
nickel = remainder / 5;
penny = remainder % 5;
cout
#
#
//$20
#
#
//$10
#
#
//$5
#
23
//$1
%23
//$0.25
#
#
#3
//$0.10
//$0.05
//$0.01
#3
#
<« "\nTwenty \t" << twenty
<« "\nTen
<« "\nFive
« "\nOne
<« "\nQuarter \t" << quarter
« "\nDime
<« "\nNickel \t" << nickel
« "\nPenny
#
\t" << ten
\t" << five
\t" << one
23
23
2#
#
\t" <« dime
#
\t" « penny « endl;
#3
}//end main()
# SAMPLE OUTPUT:
23
Enter amount of cash (56.68): 56.68
#3
%23
Twenty
#
2
1
Ten
Five
One
Quarter
#
#
#
#
Dime
Nickel
Penny
1
#
23
3
Transcribed Image Text:File: Money.asm # Author: ************ Date: mm/dd/yyyy # Purpose: Practice floating point; Break down cash to bills and coins #- # WRITE MIPS CODE FOR THE FOLLOWING C++ CODE: #include <iostream> #include <string> #include <math.h> #using namespace std; float cash; int remainder , twenty, ten, five, one, quarter, dime, nickel, penny; void main() { # # # cout <« "Enter amount of cash: "; //enter 56.68 cin >> cash; remainder = (int)(100.0f * cash) //use integers from now on twenty = remainder / 2000; remainder = remainder % 2000; ten = remainder / 1000; remainder = remainder %, 1000; five = remainder / 500; remainder = remainder % 500; one = remainder / 100: remainder = remainder % 100; quarter = remainder / 25; remainder = remainder % 25; dime = remainder % / 10; remainder = remainder % 10; nickel = remainder / 5; penny = remainder % 5; cout # # //$20 # # //$10 # # //$5 # 23 //$1 %23 //$0.25 # # #3 //$0.10 //$0.05 //$0.01 #3 # <« "\nTwenty \t" << twenty <« "\nTen <« "\nFive « "\nOne <« "\nQuarter \t" << quarter « "\nDime <« "\nNickel \t" << nickel « "\nPenny # \t" << ten \t" << five \t" << one 23 23 2# # \t" <« dime # \t" « penny « endl; #3 }//end main() # SAMPLE OUTPUT: 23 Enter amount of cash (56.68): 56.68 #3 %23 Twenty # 2 1 Ten Five One Quarter # # # # Dime Nickel Penny 1 # 23 3
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Concept of memory addresses in pointers
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education