Answer:
- #include <iostream>
- using namespace std;
- struct Money{
- int dollar;
- int cents;
- };
- int main()
- {
- Money sales;
- cout<<"Input dollar: ";
- cin>>sales.dollar;
- cout<<"Input cents: ";
- cin>>sales.cents;
- cout<<"$"<<sales.dollar<<"."<<sales.cents;
- return 0;
- }
Step-by-step explanation:
The solution code is written in C++.
Firstly, create a data structure Money with two int fields, dollar and cents. (Line 4 - 7).
Create a Money type object, sales (Line 11).
Prompt user for input dollar and cents and set the input values to the dollar and cents data fields of sales object (Line 12 - 15).
Print out the dollar and cents from sales object (Line 16).