Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- struct RadiansImpl {
- static RadiansImpl INSTANCE;
- };
- double operator-(double deg, RadiansImpl radImpl) {
- return deg / 180.0 * M_PI;
- }
- #define degrees -RadiansImpl::INSTANCE
- struct DegreesImpl {
- static DegreesImpl INSTANCE;
- };
- double operator-(double rad, DegreesImpl degImpl) {
- return rad / M_PI * 180.0;
- }
- #define radians -DegreesImpl::INSTANCE
- int main() {
- std::cout << "Hello World!\n";
- std::cout << 90 degrees << "\n";
- std::cout << M_PI radians << "\n";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement