Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- using namespace std;
- int main() {
- double number;
- cin >> number;
- string inputMetric, outputMetric;
- cin >> inputMetric >> outputMetric;
- if (inputMetric == "mm") {
- if (outputMetric == "cm") {
- number /= 10;
- }
- else {
- number /= 1000;
- }
- }
- else if (inputMetric == "cm") {
- if (outputMetric == "m") {
- number /= 100;
- }
- else {
- number *= 10;
- }
- }
- else {
- if (outputMetric == "cm") {
- number *= 100;
- }
- else {
- number *= 1000;
- }
- }
- cout << fixed << setprecision(3) << number << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement