CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Threaded View

  1. #1
    Join Date
    Dec 2010
    Posts
    121

    Retrieving Mathematical formulae and manipulating them with C++?

    Code:
    #define formula_( operand0, operator0, operand1 ) printf_s("%d %s %d", ##operand0, ##operator0, ##operand1 )
      
    int red = 1;
    int green = 2;
    int blue = 3;
    
    int v = formula_(red, "+", blue);
    How come the answer is five? What is the best way to store mathematical formulae? This is basically run-time thing, I can't build them in.
    thanks
    Jack
    Last edited by luckiejacky; June 18th, 2018 at 11:41 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured