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