Advertisement
bobo_bobkata

Untitled

Jun 19th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.61 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     double num;
  6.     cin >> num;
  7.     string from, to;
  8.     cin >> from >> to;
  9.     cout.setf(ios::fixed);
  10.     cout.precision(3);
  11.     if (from == "mm" && to == "m") {
  12.         cout << num / 1000 << endl;
  13.     }
  14.     else if (from == "m" && to == "mm") {
  15.         cout << num * 1000 << endl;
  16.     }
  17.     else if (from == "m" && to == "cm") {
  18.         cout << num * 100 << endl;
  19.     }
  20.     else if (from == "cm" && to == "mm") {
  21.         cout << num * 10 << endl;
  22.     }
  23.     else if (from == "cm" && to == "m") {
  24.         cout << num / 100 << endl;
  25.     }
  26.     else if (from == "mm" && to == "cm") {
  27.         cout << num / 10 << endl;
  28.     }
  29.     return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement