81 986
Assignments Done
98,6%
Successfully Done
In November 2019

# Answer to Question #33156 in C++ for Ha Na Choi

Question #33156
Write a program to convert currency from UK pounds or sterling to US dollar. Read the quantity of money in pounds and pence, and output the resulting foreign currency in dollars and cents. (One pound is 100 penny). Use a const to represent the conversion rate, which is \$2.018 to &pound;1 currently. Be sure to print suitable headings and or labels for the values to be output.
1
2013-07-16T08:54:56-0400
#include <iostream>
#include <cmath>
using namespace std;

const double rate = 2.018;

int main() {
int pounds, pence;
cout << "Enter the amount of pound: ";
cin >> pounds;
cout << "Enter the amount of pence: ";
cin >> pence;
cout << pounds << " punds " << pence << " pence = ";
pence = pounds*100 + pence;
int cents = round(pence * rate);
cout << cents/100 << " dollars ";
cout << cents-cents/100*100 << " cents
";
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!