hnOsmium0001

radians

Jan 22nd, 2020
165
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. struct RadiansImpl {
  5.     static RadiansImpl INSTANCE;
  6. };
  7. double operator-(double deg, RadiansImpl radImpl) {
  8.     return deg / 180.0 * M_PI;
  9. }
  10. #define degrees -RadiansImpl::INSTANCE
  11.  
  12. struct DegreesImpl {
  13.     static DegreesImpl INSTANCE;
  14. };
  15. double operator-(double rad, DegreesImpl degImpl) {
  16.     return rad / M_PI * 180.0;
  17. }
  18. #define radians -DegreesImpl::INSTANCE
  19.  
  20. int main() {
  21.   std::cout << "Hello World!\n";
  22.   std::cout << 90 degrees << "\n";
  23.   std::cout << M_PI radians << "\n";
  24. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×