homer512 icon

print self

homer512 | PRO | 05/14/14 06:00:51 PM UTC | 0 ⭐ | 643 👁️ | Never ⏰ | []
C++ |

310 B

|

None

|

0 👍

/

0 👎

#include <iostream>
 
/**
 * Print-eval
 *
 * Writes code as string to stdout, then executes it in current context
 */
#define PE(code) std::cout << #code << std::endl; code
 
int main()
{
  PE(int x = 5;)
  PE(x += 3;)
  PE(for(int i = 0; i < 3; ++i)
     {
       x += 2;
     }
  )
  PE(return x;)
}

Comments