// This file contains examples of taking C++ code and modifying every binary // operator to use prefix rather than infix notation, using the C++ convention // of preceding the operator with the keyword "operator". For example, this // infix expression: // 2 + 3 * 8 // is converted to this prefix expression: // operator+(operator*(3, 8)) #include using namespace std; int main() { int x, y; x = y = 2 + 3; // operator=(x, operator=(y, operator+(2, 3))) x = 7 + 2 * x; // operator=(x, operator+(7, operator*(2, x))) y += x + 3; // operator+=(y, operator+(x, 3)) cout << x << " " << y << endl; // operator<<(operator<<(operator<<(operator<<(cout, x), " "), y), endl) bool b = y == 8 + x++; // operator=(b, operator==(y, operator+(8, operator++(x)))) return 0; }