a53

Celsius2Fahrenheit2Kelvin

a53
Apr 23rd, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4. long double n;
  5.  
  6. char c;
  7.  
  8. int main()
  9. {
  10. cin>>n;
  11. cin.get();
  12. cin>>c;
  13. if(c=='C')
  14. {
  15. cout<<fixed<<setprecision(2)<<n<<'\n';
  16. cout<<fixed<<setprecision(2)<<9.0/5.0*n+32<<'\n';
  17. cout<<fixed<<setprecision(2)<<n+273.15<<'\n';
  18.  
  19. }
  20. else if(c=='F')
  21. {
  22. cout<<fixed<<setprecision(2)<<5.0/9.0*(n-32)<<'\n';
  23. cout<<fixed<<setprecision(2)<<n<<'\n';
  24. cout<<fixed<<setprecision(2)<<(n+459.67)*5.0/9.0<<'\n';
  25. }
  26. else if(c=='K')
  27. {
  28. cout<<fixed<<setprecision(2)<<n-273.15<<'\n';
  29. cout<<fixed<<setprecision(2)<<n*9.0/5.0-459.67<<'\n';
  30. cout<<fixed<<setprecision(2)<<n<<'\n';
  31. }
  32. return 0;
  33. }
Add Comment
Please, Sign In to add comment