SHARE
TWEET

Untitled

bobo_bobkata Jun 19th, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top